Below, you’ll find a detailed guide on how to add the Zakeke Interactive Product Designer Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Zakeke Interactive Product Designer Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Zakeke Interactive Product Designer Plugin and the shortcodes it provides:
"Zakeke Interactive Product Designer for WooCommerce is a unique plugin that allows your customers to personalize products on your WooCommerce store. With this plugin, you can increase customer engagement and sales."
- [zakeke_configurator]
Zakeke Interactive Product Designer [zakeke_configurator] Shortcode
The Zakeke Interactive Product Designer shortcode is a powerful tool that enables product customization. It fetches a specific product based on the ‘product_id’ attribute and allows users to interactively design it. The code checks if a product ID is provided. If not, it retrieves the current product. If a product doesn’t exist, it returns an error message. It then enqueues necessary scripts and loads the product design template.
Shortcode: [zakeke_configurator]
Parameters
Here is a list of all possible zakeke_configurator shortcode parameters and attributes:
product_id
– The unique identifier of the product to be configured.
Examples and Usage
Basic example – A simple usage of the ‘zakeke_configurator’ shortcode to load a product with a specific ID.
[zakeke_configurator product_id=12 /]
For more advanced usage, the ‘zakeke_configurator’ shortcode can accept multiple parameters. This can be useful to load a specific product and configure additional settings.
Advanced examples
Using the shortcode to load a product by ID and specify the modelCode as a different value. This can be useful if the product and the model have different identifiers.
[zakeke_configurator product_id=12 modelCode=15 /]
Using the shortcode without specifying a product_id. In this case, the shortcode will attempt to load the current product. If no product is loaded, it will return a message indicating that the product_id parameter was not set.
[zakeke_configurator /]
PHP Function Code
In case you have difficulties debugging what causing issues with [zakeke_configurator]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'zakeke_configurator', __CLASS__ . '::output' );
Shortcode PHP function:
function output( $atts = array() ) {
global $product;
if ( '' == $atts ) {
$atts = array();
}
if ( isset( $atts['product_id'] ) ) {
$product = wc_get_product( intval( $atts['product_id'] ) );
} else {
$product = wc_get_product();
$atts['product_id'] = $product->get_id();
}
if ( ! $product ) {
return '<-- Zakeke Configurator: product_id parameter not set --!>';
}
$atts['modelCode'] = $atts['product_id'];
self::enqueue_scripts();
$final_atts = shortcode_atts(
self::default_parameters( $product ),
$atts,
'zakeke_configurator'
);
ob_start();
include self::template_loader_shortcode();
return ob_get_clean();
}
Code file location:
zakeke-interactive-product-designer/zakeke-interactive-product-designer/includes/class-zakeke-configurator.php
Conclusion
Now that you’ve learned how to embed the Zakeke Interactive Product Designer Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply