How to add shortcode for best selling products in store front end theme?

  • 0

Add following code in your functions.php:

function storefront_best_selling_products( $args ) {

if ( storefront_is_woocommerce_activated() ) {
$args = apply_filters( ‘storefront_best_selling_products_args’, array(
‘limit’   => 5,
‘columns’ => 5,
‘title’      => esc_attr__( ‘Best Sellers’, ‘storefront’ ),
) );
echo ‘<section class=”storefront-product-section storefront-best-selling-products” aria-label=”Best Selling Products”>’;
do_action( ‘storefront_homepage_before_best_selling_products’ );
do_action( ‘storefront_homepage_after_best_selling_products_title’ );
echo storefront_do_shortcode( ‘best_selling_products’, array(
‘per_page’ => intval( $args[‘limit’] ),
‘columns’  => intval( $args[‘columns’] ),
) );
do_action( ‘storefront_homepage_after_best_selling_products’ );
echo ‘</section>’;
}
}
add_shortcode( ‘best_sellers’, ‘storefront_best_selling_products’ );

Add following code in your functions.php: function storefront_best_selling_products( $args ) { if ( storefront_is_woocommerce_activated() ) { $args = apply_filters( ‘storefront_best_selling_products_args’, array( ‘limit’   => 5, ‘columns’ => 5, ‘title’      => esc_attr__( ‘Best Sellers’, ‘storefront’ ), ) ); echo ‘<section class=”storefront-product-section storefront-best-selling-products” aria-label=”Best Selling Products”>’; do_action( ‘storefront_homepage_before_best_selling_products’ ); do_action( ‘storefront_homepage_after_best_selling_products_title’ ); echo storefront_do_shortcode( ‘best_selling_products’, array( ‘per_page’…

Add following code in your functions.php: function storefront_best_selling_products( $args ) { if ( storefront_is_woocommerce_activated() ) { $args = apply_filters( ‘storefront_best_selling_products_args’, array( ‘limit’   => 5, ‘columns’ => 5, ‘title’      => esc_attr__( ‘Best Sellers’, ‘storefront’ ), ) ); echo ‘<section class=”storefront-product-section storefront-best-selling-products” aria-label=”Best Selling Products”>’; do_action( ‘storefront_homepage_before_best_selling_products’ ); do_action( ‘storefront_homepage_after_best_selling_products_title’ ); echo storefront_do_shortcode( ‘best_selling_products’, array( ‘per_page’…