REST Support
-
Please let me know why this plugin is not working with wp rest custom routes,
here is a simple example:register_rest_route('my_plguin/v1/, '/products/check_sale', [
'methods' => 'GET',
'callback' => function() {
$product_id = 139843;
$product = wc_get_product($product_id);
$sale_price = $product->get_sale_price();
return rest_ensure_response(['sale_price' => $sale_price]);
},
'permission_callback' => '__return_true',
]);
it returns regular price event if there is a configured one discount for this product
any ideas for this issue?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.