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_cart_item_offer_text', function ($text, $cart_item) { | |
| if (method_exists('\CUW\App\Helpers\Offer', 'getText')) { | |
| $text = \CUW\App\Helpers\Offer::getText($cart_item['data'], $cart_item['cuw_offer']['discount'], 'cart'); | |
| $text = '<span class="cuw-offer-text">' . __("Save", 'checkout-upsell-woocommerce') . ' ' . $text . '</span>'; | |
| } | |
| return $text; | |
| }, 100, 2); |
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
| // NOTE: This snippets works in Checkout Upsell plugin version 1.4.1 and above | |
| add_action('woocommerce_mini_cart_contents', function () { | |
| if (defined('CUW_VERSION') && version_compare(CUW_VERSION, '1.4.1', '>=')) { | |
| if (method_exists('\CUW\App\Modules\Campaigns\CartUpsells', 'getOffersHtml')) { | |
| echo \CUW\App\Modules\Campaigns\CartUpsells::getOffersHtml('shortcode', true, false); | |
| } | |
| } | |
| }, 20); |
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_fbt_products_display_locations', function ($locations) { | |
| $locations['woocommerce_after_add_to_cart_form'] = esc_html__("After add to cart button", 'checkout-upsell-woocommerce'); | |
| return $locations; | |
| }); |
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_action('wp_loaded', function() { | |
| if (class_exists('CUW\App\Modules\Conditions\Base')) { | |
| class CUWAdvancedProducts extends \CUW\App\Modules\Conditions\Base | |
| { | |
| // to check condition | |
| public function check($condition, $data) { | |
| $product_ids = []; | |
| foreach ($data['products'] as $product) { | |
| $product_ids[] = $product['id']; | |
| if ($product['variation_id']) { |
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 stripe_cc payment method | |
| add_filter('cuw_post_purchase_before_payment_supported_payment_gateways', function ($methods) { | |
| $methods['stripe_cc'] = __('Credit Cards (Stripe) by Payment Plugins', 'woo-stripe-payment'); | |
| return $methods; | |
| }, 100); | |
| // handle request after payment succeed | |
| add_filter('cuw_payment_successful_result', function ($result, $order) { | |
| if ($order->get_payment_method() == 'stripe_cc') { | |
| if (substr($result['redirect'], 0, 1) == '#' && function_exists('wc_get_checkout_url')) { |
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_fbt_product_ids_to_display', function ($ids, $product) { | |
| rsort($ids); | |
| return $ids; | |
| }, 100, 2); |
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_post_purchase_supported_payment_gateways', function($payment_methods) { | |
| return array_merge([ | |
| 'woo-mercado-pago-basic' => __('Mercado Pago - Checkout Pro', 'woocommerce-mercadopago'), | |
| 'woo-mercado-pago-credits' => __('Mercado Pago - Installments without card', 'woocommerce-mercadopago'), | |
| 'woo-mercado-pago-custom' => __('Mercado pago - Customized Checkout', 'woocommerce-mercadopago') . ' (' . __('Debit and Credit', 'woocommerce-mercadopago') . ')', | |
| 'woo-mercado-pago-pix' => __('Mercado pago - Customized Checkout', 'woocommerce-mercadopago') . ' (' . __('Pix', 'woocommerce-mercadopago') . ')', | |
| 'woo-mercado-pago-ticket' => __('Mercado pago - Customized Checkout', 'woocommerce-mercadopago') . ' (' . __('Invoice', 'woocommerce-mercadopago') . ')', | |
| ], $payment_methods); | |
| }); |
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('woocommerce_coupon_get_items_to_validate', function ($items) { | |
| foreach ($items as $key => $item) { | |
| if (isset($item->object['cuw_offer'])) { | |
| unset($items[$key]); | |
| } | |
| } | |
| return $items; | |
| }, 100); |
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_offer_template_product_quantity', function ($html, $offer) { | |
| if (!empty($offer['id']) && !empty($offer['product']['id']) && function_exists('wc_get_product')) { | |
| $product = wc_get_product($offer['product']['id']); | |
| if (!empty($product) && ($product->is_virtual() || $product->is_downloadable())) { | |
| $html = '<input type="hidden" name="quantity" value="1"/>'; | |
| } | |
| } | |
| return $html; | |
| }, 100, 2); |