WooCommerce Product URL re-writing

This should work: add_action( ‘init’, ‘wpse33551_rewrites_init’ ); function wpse33551_rewrites_init(){ add_rewrite_rule( ‘product/.+\-([0-9]+)?$’, ‘index.php?post_type=product&p=$matches[1]’, ‘top’ ); } The filter function is changing the permalink to like product/my-product-name-88. You just need to tweak the regex in the second function to deal with that pattern. The regex is: product/ – matches the literal string product/ .+ – matches one … Read more

When Free shipping is available hide other shipping methods except Local pickup in WooCommerce [closed]

The following code will disable other shipping methods excluding “Local Pickup” when “Free shipping” shipping method is available. Required: Free shipping method need to be set with a minimal order amount. add_filter( ‘woocommerce_package_rates’, ‘show_hide_shipping_methods’, 100 ); function show_hide_shipping_methods( $rates ) { $free_rate_id = ”; $other_rates_ids = []; // Loop through available shipping rates foreach ( … Read more