What if in your register_rest_route()
call you can pass it the permission_callback option:
'permission_callback' => function () {
return current_user_can('customer');
// OR
return current_user_can('shop_manager');
}
That way you are sure that you are dealing with a logged in Woocommerce user??
These are the two roles that Woocommerce is adding to your site. https://docs.woocommerce.com/document/roles-capabilities/
I know it’s not answering your question directly, but I hope this helps! If I am way off, I can take the answer down.
Related Posts:
- WooCommerce: Can’t use wc_get_products for custom REST API endpoints
- Display single product attribute value on Shop page (Woocommerce)
- Get product details by url key in WordPress woocommerce
- Process checkout using WC REST API
- How to get rid of the hover zoom in WooCommerce single products
- What’s the difference between WC() and $woocommerce
- Where is the “default attribute” values located in the phpMyAdmin in Woocommerce?
- Hook and send Woocommerce data after click Place Order button
- How to build a plugin that supports authenticated POST requests to the REST API from external servers?
- Show only geolocated user country into Woocommerce checkout country fields
- Remove action on product archive page [closed]
- woocommerce_before_calculate_totals in woocommerce 3.0
- Disable email field on WooCommerce customer account details
- The correct way to override WooCommerce product gallery from a plugin [closed]
- display available size on hover, in woocommerce shop page [closed]
- Customize WooCommerce orders displayed shipping
- How can I show an empty WooCommerce cart? [closed]
- Is there a Woocommerce hook that fires when applying a coupon but before checking if it’s valid?
- How to filter Post using Meta Data REST API
- What is the action hook for an order that fails on frontend checkout in WooCommerce?
- How to unhook a function in Woocommerce Template?
- How to get all attributes with their terms related to specific Woocommerce product category [closed]
- Remove “Choose An Option” on Product Variation & Auto Select Instead
- How to stop a Gutenberg Block from firing multiple GET Requests?
- why featured product not updated in postmeta table in woocommerce?
- Output JSON object with woocommerce products
- Problem with cURL and rest API
- Programmatically adding product attributes to WP / Woo commerce
- Woo API REST : product variation price is read-only?
- Using a filter with multiple parameters and $this
- Remove Order List Row Link in WooCommerce Admin?
- Get rid of product images mobile swipe functionality from WooCommerce single product [closed]
- Which hook should I use to capture $_POST(‘password’) via profile update and password reset
- Edit WooCommerce product content based on category
- woocommerce_package_rates not fired everytime
- Category Tree In WooCommerce Product API
- How to upload Woocommerce product images via API? [closed]
- differentiate hooks and filters on the same page [closed]
- ‘profile_update’ hook alternative for WooCommerce user meta data
- How to update custom field in WooCommerce
- Viewing checkout page removes fees from mini cart
- How to handle Woocommerce API credentials
- What will make Woocommerce REST API to issue 401 [closed]
- Add Stripe Connect data to wc_stripe_payment_request
- Trying to build simple deposit code that hooks into woocommerce
- Redirect customer to login page (with other signup plugin) if user not logged in when proceeding to checkout
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Woocommerce custom endpoints
- How to subscribe free subscription on user registration in woocommerce subscription plugin?
- Woocommerce REST API – updating an order changes custom tax calculations
- How to list all WC products by their attributes values?
- Showing the WordPress standard text area on a Woocommerce Single Product Page?
- Woocommerce Moving Review Below add to cart breaks button
- Woocommerce custom search
- Woocommerce Rest Api Categories problem [closed]
- WooCommerce order complete email logic
- Get product variation attribute titles – WooCommerce
- How to change Attribute Type
- How to override Woocommerce functionality in Reports section?
- how can use woocommerce add to cart popup?
- WooCommerce – buying as well as selling
- API returns blank response after installing & uninstalling WP-rest-api plugin
- Is it possible to merge Woocommerce attributes? [closed]
- How to Update the Order-Items While Editing an Order on the WooCommerce Admin Order Screen [closed]
- woocommerce axios react
- WooCommerce Hook: Content get’s displayed twice and not AFTER the order total
- Get specific values in Woocommerce Rest API
- Best Practice – Customise a WooCommerce+WordPress Templates
- wc_get_products() not return the images details
- WooCommerce – Add product with image via REST API
- Tax are not showing on order while placing order with REST API
- JWT on Woocommerce cannot work with “Customer” role user
- How to re-arrange this hooked content?
- WooCommerce: One term for Many Product Attributes
- Woocommerce REST API – add filter to set maximum query per page for product brands [closed]
- How to exclude a taxonomy from shop & search page wooCommerce?
- Redirect no product url’s to static url
- WooCommerce – Create multiple product tags via rest api endpoint
- What Hook/Action is performed when a field in checkout form is changed in WooCommerce
- How to remove product attribute row woocommerce using code
- How to change a WooCommerce Subscription Deposit and Monthly Payment? [closed]
- How can I add a so i can show sale price under normal price
- password_reset doesnt work
- WooCommerce checkout page price break down table hook
- How to output woocommerce products to a page, style and modify the html structure
- Filter default_content only for products
- Woocommerce – Adding row to cart table
- WooCommerce Simple Product Options List
- Conditional action hook
- How can I override wp_price woocommerce function in my theme
- Using the WordPress and WooCommerce REST APIs in the same Node app
- Woocommerce: Any way to list all products *without* a specific attribute?
- Conditionally run function based on custom meta value?
- Retrieve Data from Custom Endpoint
- manage_shop_order_posts_custom_column() hook is Not working In Functions.php file in my WordPress active theme
- Display custom product option in admin order details
- Change Dashboard URL from wp-admin to wp-admin/index.php
- How to alter taxes amounts when updating an order
- How to check if woocommerce_order_item_name is use in email?
- Hooks For Design variation in woo commerce single product page