• ????
    ?? ????? ?? ?????? ?? ???? ????? ???? ???? ???? ? ???? ?? ???

    ??? ?? ???? ?? ???? ?? ?? ???? ????? ?? ??? ???? ?? ???????? ???? ???? ????? ????

    ?? ???? ????? ????? ???? ??????? ??????? ?? ????? ??????? ?????? ????? ?????? ??? ?? ?? ?? php ??????? ?? ??? ?? ???? ????? ????? ??????? ???? ??? ?? ??????? ???? ? ???? ????? ?????? ???? ??? ??????? ???? ???? ?? ?????? ???.

    ???? ???? ??????? ?? ???? ?????? Persian Woocommerce Shipping ???? ???? ?????? ?? ????? ??????? ???? ????? ?????? ??? ??? ???? ????? ???? ?? ???? ? ???? ????? ???? ?? ???? .? ???? ?????? ??? ???? ???? ??? ???? ?? ???? ??? ??? .
    ???? ??? ?????? ??? ??? ??? ??? ???? ???? ?? ???????? ????
    ?? ????

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • ????

    ?????? ????????? ?? ?? ????? ??? ?? ???? ????? ? ????? ?? ????? ????.
    ????? ?? ??? ????? ???? ????.

    Thread Starter rezad91

    (@rezad91)

    `PHP

    add_filter( ‘woocommerce_checkout_fields’ , ‘WooCommerce_EDD_Checkout’ );
    function WooCommerce_EDD_Checkout( $fields ) {
    global $woocommerce;
    $hasPhysicalProduct = false;
    if ( ! empty( $woocommerce->cart->cart_contents ) ) {
    $cart = $woocommerce->cart->get_cart();
    foreach ( $cart as $key => $values ) {

    $_product = get_product( $values[‘variation_id’] ? $values[‘variation_id’] : $values[‘product_id’] );

    if ( ! empty( $_product ) && $_product->exists() && $values[‘quantity’] > 0 )
    if ($_product->virtual == ‘no’ && $_product->downloadable == ‘no’) {
    $hasPhysicalProduct = true;
    break;
    }
    }
    }

    if (!$hasPhysicalProduct)
    {
    //unset($fields[‘billing’][‘billing_last_name’]);
    //unset($fields[‘billing’][‘billing_phone’]);
    unset($fields[‘billing’][‘billing_address_1’]);
    unset($fields[‘billing’][‘billing_address_2’]);
    unset($fields[‘billing’][‘billing_company’]);
    unset($fields[‘billing’][‘billing_city’]);
    unset($fields[‘billing’][‘billing_postcode’]);
    unset($fields[‘billing’][‘billing_country’]);
    unset($fields[‘billing’][‘billing_state’]);
    }

    return $fields;
    }
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    add_filter( ‘woocommerce_checkout_fields’ , ‘WooCommerce_EDD_Checkout’ );
    function WooCommerce_EDD_Checkout( $fields ) {
    global $woocommerce;
    $hasPhysicalProduct = false;
    if ( ! empty( $woocommerce->cart->cart_contents ) ) {
    $cart = $woocommerce->cart->get_cart();
    foreach ( $cart as $key => $values ) {

    $_product = get_product( $values[‘variation_id’] ? $values[‘variation_id’] : $values[‘product_id’] );

    if ( ! empty( $_product ) && $_product->exists() && $values[‘quantity’] > 0 )
    if ($_product->virtual == ‘no’ && $_product->downloadable == ‘no’) {
    $hasPhysicalProduct = true;
    break;
    }
    }
    }

    if (!$hasPhysicalProduct)
    {
    //unset($fields[‘billing’][‘billing_last_name’]);
    //unset($fields[‘billing’][‘billing_phone’]);
    unset($fields[‘billing’][‘billing_address_1’]);
    unset($fields[‘billing’][‘billing_address_2’]);
    unset($fields[‘billing’][‘billing_company’]);
    unset($fields[‘billing’][‘billing_city’]);
    unset($fields[‘billing’][‘billing_postcode’]);
    unset($fields[‘billing’][‘billing_country’]);
    unset($fields[‘billing’][‘billing_state’]);
    }

    return $fields;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘?????? ?? ?????? ?? ?? ??’ is closed to new replies.