Add a WooCommerce missing action hook with shortcode in Beaver Builder

Some themes or plugins remove native action hooks in WordPress / WooCommerce, however you can add them back in the layout with another action hook or shortcode insertion.

Beaver Builder is missing some WooCommerce action hooks one such one is woocommerce_before_shop_loop_item_title , you can add that back to the WooCommerce loop by doing a custom layout in a Posts module or PowerPack Product Grid.

Add the hook back by creating a shortcode in your functions.php file:

add_shortcode( 'woohook', 'woo_missing_hook' );
/**
 * Add a missing hook with shortcode
 * @since 1.0.0
 */

function woo_missing_hook() {
ob_start();
    do_action( 'woocommerce_before_shop_loop_item_title' );
return ob_get_clean();
}

Now in your custom layout add in the [woohook] shortcode to add the action hook back in.

Leave all Comment