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

  • Resolved taisho

    (@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 2 replies - 1 through 2 (of 2 total)
  • Plugin Support kellymetal

    (@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

    (@riaanknoetze)

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.