• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
    • Help
      • Online help
      • Learn Git
      • Welcome to Bitbucket
      • Keyboard shortcuts
    • Log In
    Blackrock
    1. Blackrock

    main

    Public
    Actions
    • Clone

    Learn more about cloning repositories

    You have read-only access

    Navigation
    • Source
    • Commits
    • Branches
    • All Branches Graph
    • Graphs
    • Forks
    1. Blackrock
    2. main

    Source

    main/wp-content/plugins/woocommerce-multilingual/inc/currencies/class-wcml-multi-currency-coupons.php
    Артем ШиряевАртем Ширяев committed 554847ddcb906 Apr 2021
    Raw file
    Source viewDiff to previous
    ​x
     
    1
    <?php
    2
    ​
    3
    class WCML_Multi_Currency_Coupons{
    4
    ​
    5
        private $wc_27_coupons;
    6
    ​
    7
        public function __construct() {
    8
    ​
    9
            // WooCommerce 2.7 + compatibility
    10
            $this->wc_27_coupons = method_exists( 'WC_Coupon', 'get_amount' );
    11
    ​
    12
            add_action('woocommerce_coupon_loaded', array($this, 'filter_coupon_data'));
    13
    ​
    14
        }
    15
    ​
    16
        public function filter_coupon_data($coupon){
    17
    ​
    18
            // Alias compatibility
    19
            if( !$this->wc_27_coupons ) {
    20
                if ( isset( $coupon->amount ) && ! isset( $coupon->coupon_amount ) ) {
    21
                    $coupon->coupon_amount = $coupon->amount;
    22
                }
    23
                if ( isset( $coupon->type ) && ! isset( $coupon->discount_type ) ) {
    24
                    $coupon->discount_type = $coupon->type;
    25
                }
    26
            }
    27
            //
    28
    ​
    29
            $discount_type = $this->wc_27_coupons ? $coupon->get_discount_type() : $coupon->discount_type;
    30
    ​
    31
            if( $discount_type==='fixed_cart' || $discount_type==='fixed_product' ){
    32
    ​
    33
                if( $this->wc_27_coupons ) {
    34
                    $coupon->set_amount( apply_filters( 'wcml_raw_price_amount', $coupon->get_amount() ) );
    35
                }else{ // backward compatibility
    36
                    $coupon->coupon_amount = apply_filters( 'wcml_raw_price_amount', $coupon->coupon_amount );
    37
                }
    38
    ​
    39
            }
    40
    ​
    41
            if( $this->wc_27_coupons ){
    42
    ​
    43
                $coupon->set_minimum_amount( apply_filters('wcml_raw_price_amount', $coupon->get_minimum_amount() ) );
    44
                $coupon->set_maximum_amount( apply_filters('wcml_raw_price_amount', $coupon->get_maximum_amount() ) );
    45
    ​
    46
            } else { // backward compatibility
    47
                $coupon->minimum_amount = apply_filters('wcml_raw_price_amount', $coupon->minimum_amount);
    48
                $coupon->maximum_amount = apply_filters('wcml_raw_price_amount', $coupon->maximum_amount);
    49
            }
    50
    ​
    51
        }
    52
    ​
    53
    }
    • Git repository management for enterprise teams powered by Atlassian Bitbucket
    • Atlassian Bitbucket v5.10.1
    • Documentation
    • Contact Support
    • Request a feature
    • About
    • Contact Atlassian
    Atlassian

    Everything looks good. Well let you know here if theres anything you should know about.