• Resolved Travis

    (@tjtaylor)


    Looking at the following code:

    /**
    	 * woocommerce_after_shop_loop_item hook.
    	 *
    	 * @hooked woocommerce_template_loop_product_link_close - 5
    	 * @hooked woocommerce_template_loop_add_to_cart - 10
    	 */
    	// select options and closing </a> tag
    	do_action( 'woocommerce_after_shop_loop_item' );

    How do I put something between the closing product link and the add to cart button?

    https://wordpress.org/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • somewhere above that do_action call, you could so something like this:

    add_action('woocommerce_after_shop_loop_item'. 'my_output', 7);

    You have to create a function called my_output that puts your stuff on the page. The 7 in the add_action command is the priority, which means that it will show up between the woocommerce_template_loop_product_link_close and the woocommerce_template_loop_add_to_cart outputs.

    Here’s more info about add_action: https://developer.wordpress.org/reference/functions/add_action/

    Thread Starter Travis

    (@tjtaylor)

    Thank you so much! I did not understand how priority works and now it makes complete sense.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trouble to Hooking into an Action’ is closed to new replies.