WooCommerce Registration redirect based on page ID

The woocommerce_registration_redirect is a filter hook, but NOT an action hook. I’ve tried the shortcode provided in the mentioned link in your comment above and it works for me in this way: function AS_redirection_after_registration($redirection_url) { if($redirection_url ==”first-page-slug”) // $redirection_url is the slug of the current page where the shortcode is placed return home_url(‘/my-page’); elseif($redirection_url==”second-page-slug”) return … Read more

WooCommerce which roles and capabilities control user login re-direct to Woo Account Page?

WooCommerce will only show the admin bar and give dashboard access to users who have the edit_posts or manage_woocommerce capabilities. If you don’t want to give users one of those capabilities, you can use the woocommerce_disable_admin_bar filter to give access and show the admin bar: add_filter( ‘woocommerce_disable_admin_bar’, function( $disable_admin_bar ) { if ( current_user_can( ‘my_capability’ … Read more

Set both meta_query and tax_query using wp_query->set

Just use another set() method: if ($value[‘pRange’] && $value[‘tags’]) { $wp_query->set(‘tax_query’, array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘product_tag’, ‘field’ => ‘slug’, ‘terms’ => $value[‘tags’], ), array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘slug’, ‘terms’ => $value[‘tags’], ), array( ‘taxonomy’ => ‘pa_branding’, ‘field’ => ‘slug’, ‘terms’ => $value[‘tags’], ), ) ); $wp_query->set(‘meta_query’, array( ‘relation’ => ‘AND’, … Read more

Add Name and SKU Main Product to Secondary Product to Cart

I would therefore create a new short code based on the existing one https://docs.woocommerce.com/wc-apidocs/source-class-WC_Shortcodes.html#295 Where before adding the product (sample) to the shopping cart the values ​​of the sample product will be updated with the values ​​of the (main) product. then you could using something like this $product = wc_get_product( $product_id ); $product->set_sku( 1234 ); … Read more

Disable Order Review Page when the id product

function action_woocommerce_checkout_order_review() { // Product id $product_id = 50700; // Generate cart id $product_cart_id = WC()->cart->generate_cart_id( $product_id ); // Is product in cart $in_cart = WC()->cart->find_product_in_cart( $product_cart_id ); // Product found if ( $in_cart ) { remove_action( ‘woocommerce_checkout_order_review’, ‘woocommerce_order_review’, 10 ); } } add_action( ‘woocommerce_checkout_order_review’, ‘action_woocommerce_checkout_order_review’, 1, 0 );