Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

add_filter positioning

$
0
0

Replies: 0

I wanted to add the quantity box to products in the shop front, I’ve found a way using filters to add this but I can’t seem to position it where I want it.
I understand the numbers at the end of the bracket correspond to positioning however this doesn’t work. I’ve tried to add the quantity box with add_action as this is easier to position but this doesn’t work at all.
Any help on this is appreciated.

This is what I’ve currently added to functions.php:

add_filter( ‘woocommerce_loop_add_to_cart_link’, ‘quantity_inputs_for_woocommerce_loop_add_to_cart_link’, 1, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
if ( $product && $product->is_type( ‘simple’ ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = wc_get_template_html( ‘single-product/add-to-cart/simple.php’ );
}
return $html;
}


Viewing all articles
Browse latest Browse all 59525

Trending Articles