Display quantity on product listing

Forums Min Max Default Quantity for WooCommerce Display quantity on product listing

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #103999
    Tom Anbinder
    Moderator
    Plugin Support

    Hi,

    I will have to test this, but generally, this should get you product quantities from the plugin:

    $product_id = $product->get_id();
    $default    = 1;
    $min_qty    = alg_wc_pq()->core->get_product_qty_min_max( $product_id, $default, 'min' );
    $max_qty    = alg_wc_pq()->core->get_product_qty_min_max( $product_id, $default, 'max' );
    $qty_step   = alg_wc_pq()->core->get_product_qty_step( $product_id, $default );
    

    Also – have you considered just replacing product’s add to cart form on archives with form from the single product page (in this case I believe you won’t need to add the code you’ve posted):

    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_single_add_to_cart', 10 );
    

    Please let me know if this doesn’t help.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.