Layout builder – WooCommerce “add to cart” button

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

// Add the following to custom-hooks.php or into your (child) theme’s functions.php

add_filter( ‘facetwp_builder_item_value’, function( $value, $item ) {
if ( ‘add-to-cart’ == $item[‘settings’][‘name’] ) {
global $post;
$value = do_shortcode( ‘[add_to_cart id=”‘ . $post->ID . ‘”]’ );
}
return $value;
}, 10, 2 );

{{/gist}}