Created
May 2, 2024 06:38
-
-
Save AnanthFlycart/f47beeb1792963a4a2dfc421b7fa10aa to your computer and use it in GitHub Desktop.
UpsellWP: Add Custom offer template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('cuw_templates', function ($templates) { | |
$templates['offer/custom-template-1'] = [ | |
'title' => '{discount} offer', | |
'description' => 'Hey there, you can get this offer by just clicking the checkbox below to add this offer to your order, you will never get such a discount on any other place on this site.', | |
'cta_text' => 'Get this exclusive offer now !', | |
'image_id' => 0, | |
'styles' => [ | |
'template' => ['border-width' => 'medium', 'border-style' => 'dashed', 'border-color' => '#c3c4c7', 'background-color' => '#fbfbfb'], | |
'title' => ['font-size' => '', 'color' => '#ffffff', 'background-color' => '#32cd32'], | |
'description' => ['font-size' => '', 'color' => '#525f7a', 'background-color' => '#d1ecf1'], | |
'cta' => ['font-size' => '', 'color' => '#333333', 'background-color' => '#e2e6ea'], | |
], | |
'campaigns' => ['checkout_upsells'], | |
]; | |
return $templates; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This PHP snippet will help to add custom template.
After that, you need to create your custom template file in the following path:
/wp-content/themes/<YOUR_THEME_FOLDER>/checkout-upsell-woocommerce/offer/custom-template-1.php
You can refer existing offer template such as
offer/template-1
for creating custom template