Tags pages for different Custom Post Types and WooCommerce Products sharing Post Tags

I found out ! I just had to declare the paged rewrite rule before the non-paged rewrite rule… add_rewrite_rule( ‘activities/([^/]+)/page/([0-9]{1,})/?’, ‘index.php?tag=$matches[1]&product_cat=activities&pages=$matches[2]’, ‘top’ ); add_rewrite_rule( ‘activities/tag/([^/]+)’, ‘index.php?tag=$matches[1]&product_cat=activities’, ‘top’ );

Woocomerce – Order products by float attribute in archive pages

OK… First of all, `$query->set( ‘orderby’, ‘pa_od’ );’ will most probably do nothing. You can’t order by some string and think that WordPress will guess what that is. Here is the list of possible orderby values: https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters If you want to order by custom field, then you have to do it this way: $query->set( ‘meta_key’, … Read more

Multiple sorting criteries (order by)

The solution is old as time is. And it was already described earlier. Place in functions.php class iWC_Orderby_Stock_Status { public function __construct() { // Check if WooCommerce is active if (in_array(‘woocommerce/woocommerce.php’, apply_filters(‘active_plugins’, get_option(‘active_plugins’)))) { add_filter(‘posts_clauses’, array($this, ‘order_by_stock_status’), 2000); } } public function order_by_stock_status($posts_clauses) { global $wpdb; // only change query on WooCommerce loops if (is_woocommerce() … Read more

Woocommerce REST API not considering discounts and coupons

In your coupon_lines array, each item in the array needs 2 properties: code (the coupon code itself) and amount, which is either a flat fee (eg 50.00 off) or a discount (eg 10% off). Your structure ends up looking like: “coupon_lines”: [ { “code”: “MYCODE1”, “amount”: “10.00” }, { “code”: “MYCODE2”, “amount”: “25.00” } ] … Read more