proshantamr
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Users can’t be deleted from wordpress backendHello @sakib1999
Thank you for reaching out
The
call_user_func_array
function is trying to invoke a method calledgscwoo_delete_user
, but it doesn’t exist in the classWOO_Customer_Setting
. This typically happens when:A plugin is trying to hook into the
delete_user
action without correctly defining the callback function.The hook is incorrectly registered, or the plugin code is incomplete or outdated.
To prevent this issue, we can manually remove the problematic hook that’s calling
gscwoo_delete_user
. You can add this code to your theme’sfunctions.php
file or a custom pluginadd_action(‘init’, function() {
remove_action(‘delete_user’, ‘gscwoo_delete_user’);
});
Forum: Plugins
In reply to: [WooCommerce] Percentage Coupon Maximum DiscountHello @anish9947
Thank you for your interest.
Please note that the code can be applied on the Cart page. Make sure to apply the code before proceeding to checkout. If you need assistance with applying the code on the Checkout page, please reach out to the WooCommerce Community on Slack. Thank you.
Forum: Plugins
In reply to: [WooCommerce] Percentage Coupon Maximum DiscountHello @anish9947
Thank you for your interest in this matter. I’m glad to provide a solution that I hope will address your requirement.
This code will ensure that a maximum discount limit is applied to a specific coupon in WooCommerce.
add_action( 'woocommerce_cart_calculate_fees', 'set_maximum_discount_limit', 10, 1 );
function set_maximum_discount_limit( $cart ) {
// Replace with your coupon code
$coupon_code = 'YOUR_COUPON_CODE';
// Set the maximum discount amount (in your currency)
$max_discount = 50;
if ( ! is_admin() && ! defined( 'DOING_AJAX' ) ) {
foreach( $cart->get_applied_coupons() as $coupon ) {
if( $coupon === $coupon_code ) {
$discount = $cart->get_coupon_discount_amount( $coupon_code );
if( $discount > $max_discount ) {
$cart->remove_coupon( $coupon_code );
$cart->add_fee( __( 'Maximum discount reached', 'woocommerce' ), -$max_discount );
}
}
}
}
}Forum: Plugins
In reply to: [WooCommerce] Percentage Coupon Maximum DiscountHello @anish9947
Thank you for reaching out.
I appreciate your efforts in addressing the issue. I believe the suggestion below may help provide a solution for setting a maximum limit on percentage-based coupons in WooCommerce:
Install a plugin like WooCommerce Advanced Coupons or Discount Rules for WooCommerce. These plugins allow you to set a maximum discount limit.
Here’s how to do it with Discount Rules for WooCommerce:
- Install and activate the Discount Rules for WooCommerce plugin.
- Go to WooCommerce > Woo Discount Rules.
- Create a new rule for percentage-based discounts.
- In the rule creation settings, you can define both the percentage discount and the maximum discount amount.
Forum: Plugins
In reply to: [WooCommerce] Move Social Media Share ButtonsThank you for your inquiry, @prgemini.
Upon reviewing your code, I noticed that the issue stems from an incorrect implementation of the WooCommerce hook. Specifically, the hook you’ve used doesn’t properly target the method within the class context, which is why the social media share buttons are not appearing as intended below the “Add to Cart” button on product pages.
To resolve this, I’ve corrected the hook and ensured that it references the class method appropriately. By doing so, WooCommerce can correctly identify and trigger the function after the “Add to Cart” button is rendered.
add_action( 'woocommerce_after_add_to_cart_button',array($this,'add_social_share_buttons_after_add_to_cart' ) );
public function add_social_share_buttons_after_add_to_cart() {
$url = esc_url(get_permalink());
$title = urlencode(html_entity_decode(get_the_title(), ENT_COMPAT, 'UTF-8'));
$social_networks = array(
'Facebook' => 'https://www.facebook.com/sharer/sharer.php?u=' . $url,
'Twitter' => 'https://twitter.com/intent/tweet?url=' . $url . '&text=' . $title,
'LinkedIn' => 'https://www.linkedin.com/shareArticle?url=' . $url . '&title=' . $title,
'Pinterest' => 'https://pinterest.com/pin/create/button/?url=' . $url . '&description=' . $title,
);
$share_buttons = '<div class="social-share-buttons">';
foreach ( $social_networks as $network => $share_url ) {
$share_buttons .= '<a href="' . $share_url . '" target="_blank" rel="noopener" class="social-share-link ' . strtolower( $network ) . '-share">' . $network . '</a> ';
}
$share_buttons .= '</div>';
echo $share_buttons;
}