W O O M A I L

Loading

Shortcodes in WordPress are code shortcuts that help you add dynamic content in WordPress posts, pages, and sidebar widgets. They are displayed inside square brackets like this:

[myshortcode]

This is where the Shortcode API comes in.

Basically, it allows developers to add their code inside a function and then register that function with WordPress as a shortcode, so for creating the dynamic custom shortcode, you need basic knowledge of PHP.

1. Go to the currently active theme folder then create a folder:

  • email-customizer-for-woocommerce-with-drag-drop-builder
    • ec-woo-mail-helper

2. Go to our plugin’s folder then navigate ec-woo-mail-helper and copy custom-code.php from that folder ( which you created in step 1 ) 

After doing the above steps it should look like : 

  • your active theme folder
    • email-customizer-for-woocommerce-with-drag-drop-builder
      • ec-woo-mail-helper
        • custom-code.php

IMPORTANT NOTE: 

  • After adding the custom shortcode, you will not see the result during customizing,  you can see result the only real testing or email preview mode
  • If you will edit in directly plugin folder, during upgrading plugin, you will lose changes 

Example 

For creating [ec_woo_custom_code type=”my-shortcode”] you need to use below code

 if(isset($attr['type']) && $attr['type'] == 'my-shortcode'){
    printf( __( "This text added from custom shortcode"));
 }

Through custom-code.php you can access :

WooCommerce order.  

Required variable : $order 

For more information please visit : https://docs.woocommerce.com/wc-apidocs/class-WC_Order.html

WooCommerce email id (new_order, completed_order,etc) .

Required variable : $email_id

For much information all shortcodes please visit: dating sites for people with money