• Resolved 007vito

    (@007vito)


    Hi,
    thanks for this awesome plugin : it’s really useful!!
    I am trying to slightly change the behavior: switching the paypal account in case of different country .I modified the code in this way

    /* ****************************************************************************** */
    function ppme_paypal_multiple_emails_check_if_enabled() {
    global $woocommerce;
    $enabled = false;

    //Get selected category option
    $paypal_multiple_emails_category = get_option( “paypal_multiple_emails_category”, “” );

    //Is PayPal Multiple Emails enabled? Blank/Empty means disabled.
    if (isset($paypal_multiple_emails_category) && !empty($paypal_multiple_emails_category)) {

    //Are there any items in cart?
    if ( empty($woocommerce->cart->cart_contents) ) { //no items in cart

    //$woocommerce->cart->cart_contents is empty so skip foreach loop below

    } else { //yes items in cart
    // CHANGES HERE
    //
    if( strcmp ($woocommerce->customer->get_shipping_country() , “Australia” ) == 0 ){
    $enabled = true;
    }
    // CHANGES ENDS HERE

    //Loop thru all items in cart
    /* foreach ((array) $woocommerce->cart->cart_contents as $key => $values ) {

    //Get all product categories for this item
    $terms = get_the_terms( $values[‘product_id’], ‘product_cat’ );

    //Loop thru all product categories of this item
    foreach ((array) $terms as $term) {

    //Check if product category matches selected category option
    if($term->slug == $paypal_multiple_emails_category){

    //YES it is enabled and item with chosen product category is in the cart
    $enabled = true;

    break;

    }
    }
    }*/
    }
    }
    return $enabled;
    }

    but for some reason seems not be good enough, do you think is possible this change? does it require other modifications ?
    please let me know
    Thanks
    Vito

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change paypal account by country?’ is closed to new replies.