Theme Integration with ShopEngine

Getting Started with Theme Support Hooks of ShopEngine #

If you are looking to make a ShopEngine compatible theme, then you will need to have access to various information related to the plugins’ modules, templates, and widgets. To help you get that information in order to build ShopEngine based themes, our team has released different theme support webhooks.

With the theme support webhooks, you can integrate ShopEngine with your theme and customize different content according to your preference. ShopEngine currently provides three Theme Support Hooks along with various functions so you can easily customize ShopEngine widgets and module contents.

Theme Support Webhooks of ShopEngine #

ShopEngine provides webhook for Quickview, Wishlist and Swatches features. Let’s have a look how you can use these :

1. Shopengine_quick_view_button_content : #

It’s a filter hook that you can use to modify the content of the Quick view module

Example:

do_action(“shopengine_quick_view_button_content”, function($quick_view_content){
  // here you can modify content or return blank
  return $quick_view_content
}

2. Shopengine_wishlist_button_content: #

It’s a filter hook that you can use to customize the content of the Wishlist

Example:

do_action(“shopengine_quick_view_button_content”, function($wishlist_content){
  // here you can modify content or return blank
  return $wishlist_content
}

3. Shopengine_swatches_anywhere: #

It’s a do_action hook. You can use this hook to print a swatch in loop product. For example: you can print all the color variations a product has on the shop page or archive page where the product list is displayed.

 Example:

do_action("shopengine_swatches_anywhere", $product, ['pa_color']);

Note: ‘pa_color’ is the attribute slug.

Functions you can call: #

Knowing the active status is essential while customizing a theme. Here are the functions you can call to know the active status of template and module alignment with other information.

1. Get Active Template List: #

To get the number templates that are active, call this function

Example:

$active_templates = \ShopEngine\Core\Theme_Support\Theme_Support::get_active_templates();

2. Get Active Module List: #

To get the number modules that are active, call this function.

Example:

$active_modules = \ShopEngine\Core\Theme_Support\Theme_Support::get_module_list();

3. Get Wishlist Product Ids: #

To get Ids of the product that are added on the Wishlist, call this function.

Example: 

$wishlist_product_ids =  \ShopEngine\Core\Theme_Support\Theme_Support::get_wishlist_product_ids();

4. Get Comparison Product Ids: #

To get the product Ids that are currently being compared using the Product Comparison Module, call this function.

Example:

$comparison_product_id = \ShopEngine\Core\Theme_Support\Theme_Support::get_comparison_product_ids();
What are your feelings
Updated on March 18, 2022