Support » Plugin: WooCommerce » Featured products shortcode – add quantity field for each product

  • Resolved taisho


    I’m using the following shortcode to show featured products on my custom page:

    [products limit=”6″ columns=”3″ orderby=”rand” visibility=”featured” ]
    It works correctly with WooCommerce 3.7.0. The problem I’m having is that I would like to add a quantity input field to each product, before Add to cart button. I already have a function to do this for Shop and Category pages:

    add_action( 'woocommerce_after_shop_loop_item', 'taisho_quantity_field', 9 );
    Unfortunately for featured products listed via this shortcode it has no effect. Is there any way I can make it work?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support kellymetal


    Hi there!

    It looks like the WooCommerce [products] shortcode uses the same content-product template file as the Shop and Category pages, so should still be able to work with the woocommerce_after_shop_loop_item action hook that you are calling there.

    I tested with that hook, and saw that content I added via the hook appeared in both the Shop page and on a page using the same [products limit=”6″ columns=”3″ orderby=”rand” visibility=”featured” ] shortcode that you are using.

    Perhaps there is something in your taisho_quantity_field function that is crashing only with the shortcode?

    Plugin Support RK


    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    I am trying to the same thing but i found that content-product.php is only affect the default Shop page, however when i use shortcode in other page, it doesn’t seem to be calling the same template file.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Featured products shortcode – add quantity field for each product’ is closed to new replies.