This topic has 25 replies, 2 voices, and was last updated 2 years, 7 months ago ago by Jemo
Hi,
I discovered that my plugin “smart coupon” don’t display the “coupon shop” for the product in case (dedicated for this plugin).
I am thiking the problem is to add the hook (into functions.php) employed by the plugin into the theme (child theme).
can you help with this?
hope yes. thanks in advance.
jemo
Hello,
Where do you want to display the coupon on a single product? After the short description?
Regads
Hi,
thanks for reply.
In fact, a “dedicated product” should display all templates from “gift card” of the “smart coupon plugin”.
The product that should display all the template is: https://www.jetentemachance.com/boutique/bons-dachats-recompenses/
The setting for this product is here: https://www.jetentemachance.com/wp-admin/post.php?post=84793&action=edit
And the setting from the plugin for this is here: https://www.jetentemachance.com/wp-admin/admin.php?page=wt-smart-coupon-for-woo_store_credit#wt-sc-gift-card-template
I have try to take your code and update it for the “smart coupon plugin” (pro version) as this:
// Make Smart Coupon compatible with XStore
add_action('init', function() {
if (function_exists('wt-smart-coupons-for-woocommerce-pro')) {
add_action( 'etheme_woocommerce_template_single_excerpt', 'wt-smart-coupons-for-woocommerce-pro', 25 );
}
});
but this make critical error (in fact i don’t understand how make this update and not if it is the good way…
*********************AND*********************** (another thing)
(code source from here: https://www.sitepoint.com/creating-a-woocommerce-redeem-coupon-page/)
perhaps you can help me for the other problem i see (another problem):
The fact: i want to display a “have a coupon” form on the front (homepage header) of my website.
so i have use this code:
//******************** RECLAMATION COUPON DU CLIENT BENEFICIAIRE BH ********************//
add_action( 'wp_ajax_bh_coupon_redeem_handler', 'bh_coupon_redeem_handler' );
add_action( 'wp_ajax_nopriv_bh_coupon_redeem_handler', 'bh_coupon_redeem_handler' );
function bh_coupon_redeem_handler() {
// Get the value of the coupon code
$codebh = $_REQUEST['coupon_code'];
// Check coupon code to make sure is not empty
if( empty( $codebh ) || !isset( $codebh ) ) {
// Build our response
$reponsebh = array(
'result' => 'error',
'message' => 'Le champ CODE COUPON ne doit pas être vide.'
);
header( 'Content-Type: application/json' );
echo json_encode( $reponsebh );
// Always exit when doing ajax
exit();
}
// Create an instance of WC_Coupon with our code
$couponbh = new WC_Coupon( $codebh );
// Check coupon to make determine if its valid or not
if( ! $couponbh->id && ! isset( $couponbh->id ) ) {
// Build our response
$reponsebh = array(
'result' => 'error',
'message' => 'Le COUPON CODE n\'est pas valide ou a déjà été utilisé. Merci de ré-éssayer.'
);
header( 'Content-Type: application/json' );
echo json_encode( $reponsebh );
// Always exit when doing ajax
exit();
} else {
// Coupon must be valid so we must
// populate the cart with the attached products
foreach( $couponbh->product_ids as $prod_id ) {
WC()->cart->add_to_cart( $prod_id );
}
// Build our response
$reponsebh = array(
'result' => 'success',
'href' => WC()->cart->get_cart_url()
);
header( 'Content-Type: application/json' );
echo json_encode( $reponsebh );
// Always exit when doing ajax
exit();
}
}
//******************** AJAX validation reponse coupon ********************//
jQuery( document ).ready( function()
{
jQuery( '#ajax-coupon-redeem input[type="submit"]').click( function( ev )
{
// Get the coupon code
var code = jQuery( 'input#coupon').val();
// We are going to send this for processing
data = {
action: 'bh_coupon_redeem_handler',
coupon_code: code;
}
// Send it over to WordPress.
jQuery.post( woocommerce_params.ajax_url, data, function( returned_data )
{
if( returned_data.result == 'error' )
{
jQuery( 'p.result' ).html( returned_data.message );
} else {
// Hijack the browser and redirect user to cart page
window.location.href = returned_data.href;
}
})
// Prevent the form from submitting
ev.preventDefault();
});
});
into my functions child theme.. but the “ajax validation code” make critical error (because i’d like to see the answer “valide coupon” for example disply just above the form…
the ajax funtion for validation is:
//******************** AJAX validation answer coupon ********************//
jQuery( document ).ready( function()
{
jQuery( '#ajax-coupon-redeem input[type="submit"]').click( function( ev )
{
// Get the coupon code
var code = jQuery( 'input#coupon').val();
// We are going to send this for processing
data = {
action: 'bh_coupon_redeem_handler',
coupon_code: code
}
// Send it over to WordPress.
jQuery.post( woocommerce_params.ajax_url, data, function( returned_data )
{
if( returned_data.result == 'error' )
{
jQuery( 'p.result' ).html( returned_data.message );
} else {
// Hijack the browser and redirect user to cart page
window.location.href = returned_data.href;
}
})
// Prevent the form from submitting
ev.preventDefault();
});
});
i don’t want abuse for help but i am blocked with this too…
i ‘ll appreciate you can tell me where is the problem with it?
I have create a “static block” for display the form as this:
<div class="cadre-coupon">
<div class="redeem-coupon" style="text-align: center;">
<h2><span style="color: #ff00ff;">Echangez vos COUPONS CODES</span></h2>
<form id="ajax-coupon-redeem"><input id="coupon" name="coupon" type="text" /><input name="redeem-coupon" type="submit" value="Validez votre COUPON CODE" />
</form><!-- #ajax-coupon-redeem -->
</div>
</div>
perhaps the “Ajax code” must go with this code and not on the functions.php file? but i don’t know if i can add this AJAC code into the “static block” ? yes ? no? if yes how i must do for not have critical error? must i add a plugin for can adding code into the “post” of the “static block”?
and must the “ajax code” go into PHP balise or not?
lol
i know, i am not a developer so excuse for stupid question
hope you can answer / help me with this
Hello,
Point is that we are unable to provide support for customizations under our Support Policy https://themeforest.net/page/item_support_policy
So, we have fixed the appearance of the coupon on the single product but if you want anything extra of plugin settings (like displaying coupon on the home page if there is no such option in the plugin) then you need to contact the plugin author with this question.
To fix compatibility we added the below code https://gyazo.com/09c25ef2af241c28b34a682cc9ebec21
Regards
Hi
Thanks a lot for the fix.
For the “coupon form”, it is only that i need customer can claim their coupon directly on the homepage and not only on the checkout page: it is not a plugin customization
because in my future activity, i want to sell “coupon code” for “pro customer” that this type of customer give for free to their customer.
So their customer (of the pro customer at who i sell coupon code) come to my website and claim their “codes” they have given by the pro customer for free…
i don’t know if i am clear with that… so i have search any code for can do this (add on the header of the website the form for claim coupon code…
nothing else…
i am thinking for that it is only the “ajax code” that be placed on the bad wey (in fact i don’t know, it is why i asked you that)
hope you understand…
Hello,
We don’t have a coupon feature in our theme. So, this is something that is outside our support. If you want to customize something and need help with that you may submit customization request here.
Our support is able to help only with issues that are related strictly to our theme, not with your additional customization.
Reagrds
Ha ok. Thanks
and thanks a lot for your precious help
🙂
you are top!
Hello,
You are welcome.
Regards
Hi
I have a question.
The module called “Request a quote”: is it possible to show it only on a specific page? or to a specific user role?
and is it forcely a popup? can’t show it for example on a “normal page” ?
If yes, how must i do?
thanks in advance
Hello,
We don’t have such an option at this moment. You can enable it either on the single product or for all the products + all pages https://gyazo.com/1c83f46d2818362eeb46685b666afe3f
If you want to show “Request a quote” only on a specific page you can submit feature request here https://www.8theme.com/taskboard/
Or look for the third-party plugin that already has such option.
Regards
Hi thanks for reply
the link taskboard seems not working (not found page)
Hello,
You need to be logged in to be able to follow the link. Or go to https://www.8theme.com/forums/xstore-wordpress-support-forum/ and click the Feature request icon in the middle.
Regards
Ha ok…. sorry thanks
I have 2 questions more:
1/ how can i break the line and put the first element on middle center and the second element as the same (middle and center) (see private content)
(not the two element side by side) ?
and
2/ how can i add a space beetween text and price into the button ? where i can find the file that display this button for addind this “space”? (see private content)
thanks in advance
Hello,
Sorry but links to screenshots that you provided do not work. Could you please upload screenshots here https://dropmefiles.com/ and provide us with link?
Regards
Hi thanks for reply
link should work (test before okay)
*********
The plugin “Translator Revolution DropDown” that i use is not display on website… i think it is as the other plugin that need a code into functions.php file…
can you help with this?
sorry and thanks in advance
none
Hello,
1) Provide us with a link to the product where you have those elements because I can’t find that.
2) I replaced
.single-product .product .single_add_to_cart_button span.atct-price {
color: #fff;
}
with
.single-product .product .single_add_to_cart_button span.atct-price {
color: #fff;
margin-left: 10px;
}
3) Where did you add the languages list? How does it display with the default theme?
Regards
Hi thanks for reply
Per default, when you active the plugin “language translator”, it display at the top-top header just above the logo.
But in the setting of the plugin, i can ajust the display but with the Xstore theme, i don’t know witch attribute to put or not if this setting can be applicated with the Xstore theme.
The link of the setting is provided in private content
In the same way of the space between text and price for the button “add to cart” (thanks for that), is it possible to do the same between “quantity” text and the “input number” ?
thanks in advance
Hello,
Contact plugin author and ask if they have a shortcode of the language selector. You’ll be able to add the shortcode to the header using header builder Custom HTML block or using Widgets element.
I checked your single product page and unfortunately, it’s not possible to place “(OU) SÉLECTION MANUELLE…” text next to q-ty with the existing HTML structure. You may submit additional customization request to WPKraken team. Maybe they will be able to help you because we are unable to provide support for customizations under our Support Policy.
Add the below code to center the image
.template-container .woocommerce-product-gallery.images-wrapper, .template-container .woocommerce-product-gallery img {
margin: auto;
}
Regards
Hi,
thanks for reply.
I have use HTML block into header and fix display of the Translator dropdown. It’s work. thanks for the tip.
Hello,
You are welcome.
Regards
Hi,
i just discovered that the option general of a product in administration is not displaying (option product general where i can setting a lottery for a product): the panel have disapeared… (works integrated with lottery plugin) (normaly works but i just see that it desapeared when i try to edit a product because i don’t work on product to add actually: i just discovered this mistake when i go to “edit product”)
idem for the “Product Review Extra Settings” plugin that have desapeared too from the admin edit product… Normaly the display is into a tab into description of a product… (single product)
I just see this two problem because before changing theme it’s display fine and i just go to “edit product” and surprise…
is a missing arg in functions.php child theme?
Thanks in advance
Hi it is reappared lol
mistake lol
Hello,
So, is that issue fixed? May I close the topic?
Regards
yes thanks 🙂
Tagged: compatibility, help, plugin, smartcoupon, theme, woocommerce, wordpress
The issue related to '‘Need help: plugin Smart Coupon seems to not be compatible with the theme’' has been successfully resolved, and the topic is now closed for further responses