WooCommerce Select Variations on Shop Page
Today we talk about WooCommerce or WordPress select variation on shop page programmatically. In this tutorial, We focus on how to show select/dropdown on the shop page. It will be easier for customers to add to the cart with variations from the shop page. It will eliminate the step of the go-to single page and add to the cart from there.
Let’s start with our example.
add_action('woocommerce_before_shop_loop', 'qaisar_satti_variations_dropdown');
function qaisar_satti_variations_dropdown() {
remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ); // remove already add to cart
add_action('woocommerce_after_shop_loop_item', 'woocommerce_template_single_add_to_cart', 50 );// add sigle page add to cart
}
function qaisar_satti_variations_dropdown() {
remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ); // remove already add to cart
add_action('woocommerce_after_shop_loop_item', 'woocommerce_template_single_add_to_cart', 50 );// add sigle page add to cart
}