The product listings display differently between the standard WooCommerce Archive pages (Category page) and WooCommerce Blocks. 2 Main Challenges:
I want to add the Short Description, and Quantity Selector to the product listing for the WooCommerce Blocks (specifically the "Products by Category" block).
Match the styles of the WooCommerce Blocks to the existing WooCommerce styles (this just may have to be done manually by adding additional css).
Here is a screenshot of the Archive Category page which I want to replicate for the WooCommerce Blocks.
Here is a screenshot of the WooCommerce "Products by Category" block.
I've already added a php snippet provided by WooCommerce to add the Quantity Selector to the Archive pages, however it does not add it to the WooCommerce Blocks:
/**
* Override loop template and show quantities next to add to cart buttons
*/
add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 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 = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
$html .= woocommerce_quantity_input( array(), $product, false );
$html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
$html .= '</form>';
}
return $html;
}
Is there a similar solution to hook into a filter to add the Short Description and Quantity Selector to the WooCommerce Blocks?
I believe this is the filter for the products in grid used across multiple blocks: 'woocommerce_blocks_product_grid_item_html'
I did find this other stack overflow article that seems to have a solution for adding the short description, just not sure how to tweak it to also add the Quantity Selector...
Any help would be greatly appreciated! Thank you!