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)
- Process checkout using WC REST API
- 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?
- Remove action on product archive page [closed]
- woocommerce_before_calculate_totals in woocommerce 3.0
- Disable email field on WooCommerce customer account details
- display available size on hover, in woocommerce shop page [closed]
- Customize WooCommerce orders displayed shipping
- 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?
- why featured product not updated in postmeta table in woocommerce?
- Woo API REST : product variation price is read-only?
- Using a filter with multiple parameters and $this
- Get rid of product images mobile swipe functionality from WooCommerce single product [closed]
- 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]
- Viewing checkout page removes fees from mini cart
- 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
- Woocommerce custom endpoints
- Woocommerce Moving Review Below add to cart breaks button
- WooCommerce order complete email logic
- 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
- 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
- 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
- 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
- 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
- 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?
- 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
- How to add woocommerce products header title in woocommerce_breadcrumb hook to function.php
- Missing variable options on add to cart form
- Help to locate a woocommerce hook method
- How to solve `Error getting remote image` in woocommerce rest api script?
- CallBack URL for payment gateway redirecting to homepage instead of executing callback function
- Getting in an exception for get product detail by id in woocommerce REST api
- Impossible to create a new WooCommerce customer using Rest API
- How can I send information when a order is completed to my own POS?
- check shipping amount in woocommerce_after_checkout_validation?
- How to display two different custom taxonomy terms on a WooCommerce single product page
- Woocommerce Rest API: woocommerce_product_invalid_image_id
- Woocommerce Disabling Auto Restocking for Cancelled Orders
- Parameters in woocommerce_before_add_to_cart_button hook
- Unable to call woocommerce hook in my custom php file
- How can i add product Accessories from front-end using custom php form?
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Remove username and account password field from checkout page
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- “error_message”: “Sorry, you cannot list resources.” using WooCommerce API
- How to create callback function which returns all posts with specific data?
- Woocommerce REST API: creating variations
- How to add product variations for large number of products in WooCommerce?
- Add suffix to price html does not work
- Woocommerce: Unique price for individual basket items
- Importing Attributes in to Woocommerce
- Create woocommerce order on new user registration
- WooCommerce – Adding Product Attributes to CSV Export
- WordPress and WooCommerce How to Assign Attribute Based Pricing
- WooCommerce REST API endpoints don’t exist
- Create templates from attributes for categories
- Callback API for getting response from fygaro payment gateway
- Hide a shipping method if cart total is higher than an amount
- Send data to external websites when there is an update or create a post
- Auto generating API keys using the Application Authentication Endpoint [closed]
- Use a woocommerce hook to create a table and populate it with a query
- Copy and Modified WooCommerce function is_coupon_valid [closed]