Home Forums WoodMart support forum Moving from porto to woodmart

Moving from porto to woodmart

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #527014

    alexisrael
    Participant

    Hello!

    I’m trying to move from my previous theme (PORTO) to woodmart, but after I import the kids demo, I cannot see the homepage properly or the footer. or any other elements like in the demo.

    Now its on subdomain for testing only.

    #527142

    Hello,

    Please try to deactivate the plugins not related to the theme and import the demo again.

    Note that our dummy content works only on a fresh installation. If you have some content already it will conflict with your existing posts and most of the content will not be imported correctly.

    If the issue remains let me know i will check and import the demo on your site.

    Best Regards.

    #527156

    alexisrael
    Participant

    Thanks!
    I’ve deactivated everything and it looks to be working.

    Now, I copy all the theme Functions (functions.php) from porto to woodmart, and they seem not to function, these are supposed to be universal woocommerce codes.

    These are the codes:

    function razztech_wc_terms( $terms_is_checked ) { return true;}
    add_filter( ‘woocommerce_terms_is_checked’, ‘razztech_wc_terms’, 10 );
    add_filter( ‘woocommerce_terms_is_checked_default’, ‘razztech_wc_terms’, 10 );

    //add_filter( ‘woocommerce_cart_needs_shipping_address’, ‘__return_false’);

    add_action( ‘woocommerce_applied_coupon’, ‘custom_applied_coupon’, 10, 1 );
    function custom_applied_coupon( $coupon_code ){
    $applied_coupons = WC()->cart->get_applied_coupons();
    $coupons_allowed_max = 1; // <=== 1 coupons allowed max

    if( sizeof($applied_coupons) > $coupons_allowed_max ) {
    WC()->cart->remove_coupon( $coupon_code );
    wc_clear_notices();
    wc_print_notice(__(“ניתן להשתמש רק בקופון אחד בו זמנית”, “woocommerce”), ‘error’);
    }
    }

    // defalut contry field
    add_filter( ‘default_checkout_billing_country’, function(){
    return ‘IL’;
    } );

    // Change “city” checkout billing and shipping fields to a dropdown
    add_filter( ‘woocommerce_checkout_fields’ , ‘override_checkout_city_fields’, 999999);
    function override_checkout_city_fields( $fields ) {

    // Define here in the array your desired cities (Here an example of cities)
    $option_cities = array(
    ” => __( ‘אנא בחרו עיר למשלוח’ ),

    ‘תוכנית ה80-20’ => ‘תוכנית ה80-20’,
    ‘אביחיל’ => ‘אביחיל’,
    ‘אבן יהודה’ => ‘אבן יהודה’,
    ‘אודים’ => ‘אודים’,
    ‘אור יהודה’ => ‘אור יהודה’,
    ‘אור עקיבא’ => ‘אור עקיבא’,
    ‘אזור’ => ‘אזור’,
    ‘אלישמע’ => ‘אלישמע’,
    ‘אמונים’ => ‘אמונים’,
    ‘ארסוף’ => ‘ארסוף’,
    ‘אשקלון’ => ‘אשקלון’,
    ‘אשדוד’ => ‘אשדוד’,
    ‘באר יעקב’ => ‘באר יעקב’,
    ‘בית אלעזרי’ => ‘בית אלעזרי’,
    ‘בית דנן’ => ‘בית דנן’,
    ‘בית חנן’ => ‘בית חנן’,
    ‘בית חנניה’ => ‘בית חנניה’,
    ‘בית יהושע’ => ‘בית יהושע’,
    ‘בית יצחק’ => ‘בית יצחק’,
    ‘שער חפר’ => ‘שער חפר’,
    ‘בית עובד’ => ‘בית עובד’,
    ‘בן זכאי’ => ‘בן זכאי’,
    ‘בני ברק’ => ‘בני ברק’,
    ‘בני דרור’ => ‘בני דרור’,
    ‘בני עייש’ => ‘בני עייש’,
    ‘בני ציון’ => ‘בני ציון’,
    ‘בנימינה’ => ‘בנימינה’,
    ‘בצרה’ => ‘בצרה’,
    ‘בת ים’ => ‘בת ים’,
    ‘גאולים’ => ‘גאולים’,
    ‘גבעת השלושה’ => ‘גבעת השלושה’,
    ‘גבעת חן’ => ‘גבעת חן’,
    ‘גבעת שמאול’ => ‘גבעת שמאול’,
    ‘גבעתיים’ => ‘גבעתיים’,
    ‘גדרה’ => ‘גדרה’,
    ‘גיבתון’ => ‘גיבתון’,
    ‘גליל ים’ => ‘גליל ים’,
    ‘גן יבנה’ => ‘גן יבנה’,
    ‘גן חיים’ => ‘גן חיים’,
    ‘גנות הדר’ => ‘גנות הדר’,
    ‘גני תקווה’ => ‘גני תקווה’,
    ‘געש’ => ‘געש’,
    ‘הוד השרון’ => ‘הוד השרון’,
    ‘הרצליה’ => ‘הרצליה’,
    ‘זייתן’ => ‘זייתן’,
    ‘זכרון יעקב’ => ‘זכרון יעקב’,
    ‘חדרה’ => ‘חדרה’,
    ‘חולון’ => ‘חולון’,
    ‘חיפה’ => ‘חיפה’,
    ‘חירות’ => ‘חירות’,
    ‘חמד’ => ‘חמד’,
    ‘חצור’ => ‘חצור’,
    ‘חרוצים’ => ‘חרוצים’,
    ‘חרות’ => ‘חרות’,
    ‘יבנה’ => ‘יבנה’,
    ‘יגור’ => ‘יגור’,
    ‘יהוד’ => ‘יהוד’,
    ‘ינוב’ => ‘ינוב’,
    ‘יעבץ’ => ‘יעבץ’,
    ‘יפו’ => ‘יפו’,
    ‘יקום’ => ‘יקום’,
    ‘כפר הנגיד’ => ‘כפר הנגיד’,
    ‘כפר הס’ => ‘כפר הס’,
    ‘כפר חבד’ => ‘כפר חבד’,
    ‘כפר יונה’ => ‘כפר יונה’,
    ‘כפר מל”ל’ => ‘כפר מל”ל’,
    ‘כפר מעש’ => ‘כפר מעש’,
    ‘כפר נטר’ => ‘כפר נטר’,
    ‘כפר סבא’ => ‘כפר סבא’,
    ‘כפר סירקין’ => ‘כפר סירקין’,
    ‘כפר שמריהו’ => ‘כפר שמריהו’,
    ‘לוד’ => ‘לוד’,
    ‘מודיעין’ => ‘מודיעין’,
    ‘מזור’ => ‘מזור’,
    ‘מזכרת בתיה’ => ‘מזכרת בתיה’,
    ‘מכבים רעות’ => ‘מכבים רעות’,
    ‘מעגן מיכאל’ => ‘מעגן מיכאל’,
    ‘משמר השבעה’ => ‘משמר השבעה’,
    ‘נווה ירק’ => ‘נווה ירק’,
    ‘נופך’ => ‘נופך’,
    ‘נורדיה’ => ‘נורדיה’,
    ‘נטעים’ => ‘נטעים’,
    ‘ניר צבי’ => ‘ניר צבי’,
    ‘נס ציונה’ => ‘נס ציונה’,
    ‘נתניה’ => ‘נתניה’,
    ‘נשר’ => ‘נשר’,
    ‘סביון’ => ‘סביון’,
    ‘עדנים’ => ‘עדנים’,
    ‘עזריאל’ => ‘עזריאל’,
    ‘עין ורד’ => ‘עין ורד’,
    ‘עין שריד’ => ‘עין שריד’,
    ‘עינת’ => ‘עינת’,
    ‘פורת’ => ‘פורת’,
    ‘פרדס חנה’ => ‘פרדס חנה’,
    ‘כרכור’ => ‘כרכור’,
    ‘פרדסיה’ => ‘פרדסיה’,
    ‘פתח תקווה’ => ‘פתח תקווה’,
    ‘צופית’ => ‘צופית’,
    ‘צור משה’ => ‘צור משה’,
    ‘צורן’ => ‘צורן’,
    ‘קדימה’ => ‘קדימה’,
    ‘קיסריה’ => ‘קיסריה’,
    ‘קרית אונו’ => ‘קרית אונו’,
    ‘קרית עקרון’ => ‘קרית עקרון’,
    ‘קרית חיים’ => ‘קרית חיים’,
    ‘קרית ים’ => ‘קרית ים’,
    ‘קרית ביאליק’ => ‘קרית ביאליק’,
    ‘קרית מוצקין’ => ‘קרית מוצקין’,
    ‘קרית אתא’ => ‘קרית אתא’,
    ‘ראש העין’ => ‘ראש העין’,
    ‘ראשון לציון’ => ‘ראשון לציון’,
    ‘רחובות’ => ‘רחובות’,
    ‘רינתיה’ => ‘רינתיה’,
    ‘רמות השבים’ => ‘רמות השבים’,
    ‘רמלה’ => ‘רמלה’,
    ‘רמת אפעל’ => ‘רמת אפעל’,
    ‘רמת גן’ => ‘רמת גן’,
    ‘רמת השרון’ => ‘רמת השרון’,
    ‘רעננה’ => ‘רעננה’,
    ‘רשפון’ => ‘רשפון’,
    ‘שדה ורבורג’ => ‘שדה ורבורג’,
    ‘שדה עוזיהו’ => ‘שדה עוזיהו’,
    ‘שדות ים’ => ‘שדות ים’,
    ‘שפיים’ => ‘שפיים’,
    ‘שוהם’ => ‘שוהם’,
    ‘שתולים’ => ‘שתולים’,
    ‘תל אביב’ => ‘תל אביב’,
    ‘תל יצחק’ => ‘תל יצחק’,
    ‘תל מונד’ => ‘תל מונד’,

    );

    $fields[‘billing’][‘billing_city’][‘type’] = ‘select’;
    $fields[‘billing’][‘billing_city’][‘options’] = $option_cities;
    $fields[‘shipping’][‘shipping_city’][‘type’] = ‘select’;
    $fields[‘shipping’][‘shipping_city’][‘options’] = $option_cities;

    return $fields;
    }

    add_filter( ‘manage_edit-shop_order_columns’, ‘wc_new_order_column’ );
    function wc_new_order_column( $columns ) {
    $columns[‘billing_city’] = ‘עיר’;
    return $columns;
    }

    add_action( ‘manage_shop_order_posts_custom_column’, ‘tk_add_billing_city_content’ );
    function tk_add_billing_city_content($column) {
    global $post;

    $order_id = $post->ID;
    $order = wc_get_order( $order_id );
    $billing_city = $order ->get_billing_city();

    if( $column == ‘billing_city’ ) {
    echo $billing_city;
    }
    }

    add_action( ‘woocommerce_before_checkout_form’, ‘add_custom_message_to_checkout’, 1 );
    function add_custom_message_to_checkout() {

    if( !is_user_logged_in() ){

    echo ‘<div class=”custom-checkout-message”>סגור</div>’;
    ?>
    <script type=”text/javascript”>
    (function($){
    $(‘.hide-me’).on(‘click’,function(e){
    e.preventDefault();
    $(this).parent(‘.custom-checkout-message’).fadeOut(300, function() {
    $(this).parent(‘.custom-checkout-message’).remove();
    });
    });
    })(jQuery);
    </script>
    <?php

    }
    }

    /**
    * @snippet Hide Fields if Virtual @ WooCommerce Checkout
    * @how-to Get CustomizeWoo.com FREE
    * @author Rodolfo Melogli
    * @compatible WooCommerce 8
    * @donate $9 https://businessbloomer.com/bloomer-armada/
    */

    add_filter( ‘woocommerce_checkout_fields’, ‘bbloomer_simplify_checkout_virtual’ );

    function bbloomer_simplify_checkout_virtual( $fields ) {
    $only_virtual = true;
    foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
    // Check if there are non-virtual products
    if ( ! $cart_item[‘data’]->is_virtual() ) $only_virtual = false;
    }
    if ( $only_virtual ) {
    unset($fields[‘billing’][‘billing_city’]);
    unset( $fields[‘billing’][‘billing_address_1’] );
    unset( $fields[‘billing’][‘billing_address_2’] );

    unset( $fields[‘shipping’][‘shipping_city’] );
    add_filter( ‘woocommerce_enable_order_notes_field’, ‘__return_false’ );
    }
    return $fields;
    }

    Please advice,

    Thanks in advance.

    #527257

    Hello,

    Why do you want to copy the functions from porto to woodmart? It is not possible to to copy the functions from one theme to another because every theme may have different structures, hooks, and functions, which can lead to compatibility issues.

    Best Regards.

    #527372

    alexisrael
    Participant

    But those are universal cods that I used in function.php file.

    for example this standard code from stackoverfllow that I used in the same site, does not work in woodmart:

    https://stackoverflow.com/questions/65636758/change-woocommerce-checkout-city-field-to-a-dropdown-for-a-unique-country

    I just want to create a dropdown city list:

    this is the code:
    // Change “city” checkout billing and shipping fields to a dropdown
    add_filter( ‘woocommerce_checkout_fields’ , ‘override_checkout_city_fields’ );
    function override_checkout_city_fields( $fields ) {
    global $woocommerce;

    // Define here in the array your desired cities (Here an example of cities)
    $option_cities = array(
    “city1″=>”city1”,
    “city2″=>”city2”,
    “city3″=>”city3”
    );

    $country = $woocommerce->customer->get_shipping_country();
    if ($country == ‘SA’){
    $fields[‘billing’][‘billing_city’][‘type’] = ‘select’;
    $fields[‘billing’][‘billing_city’][‘options’] = $option_cities;
    $fields[‘shipping’][‘shipping_city’][‘type’] = ‘select’;
    $fields[‘shipping’][‘shipping_city’][‘options’] = $option_cities;

    } else{
    $fields[‘billing’][‘billing_city’][‘type’] = ‘text’;
    $fields[‘shipping’][‘shipping_city’][‘type’] = ‘text’;
    }

    return $fields;
    }

    What is wrong?

    #527460

    Hello,

    Please Try to add the below code to functions.php in the Child theme

    // Change "city" checkout billing and shipping fields to a dropdown
     add_filter( 'woocommerce_checkout_fields' , 'override_checkout_city_fields' ); function override_checkout_city_fields( $fields ) { 
    // Define here in the array your desired cities (Here an example of cities) 
    $option_cities = array( '' => __( 'Select your city' ), 'Karachi' => 'Karachi', 'Lahore' => 'Lahore', 'Faisalabad' => 'Faisalabad', 'Rawalpindi' => 'Rawalpindi', 'Gujranwala' => 'Gujranwala', 'Peshawar' => 'Peshawar', 'Multan' => 'Multan', 'Hyderabad' => 'Hyderabad', 'Islamabad' => 'Islamabad' ); $fields['billing']['billing_city']['type'] = 'select'; $fields['billing']['billing_city']['options'] = $option_cities; $fields['shipping']['shipping_city']['type'] = 'select'; $fields['shipping']['shipping_city']['options'] = $option_cities; return $fields; }

    Best Regards.

    #527612

    alexisrael
    Participant

    Thanks, but after adding this code to functions.php, this error appears:

    your PHP code changes were not applied due to an error on line 13 of file wp-content/themes/woodmart-child/functions.php. Please fix and try saving again.

    Cannot redeclare override_checkout_city_fields() (previously declared in wp-content/plugins/code-snippets-pro/php/snippet-ops.php(609) : eval()’d code:3

    #527779

    Hello,

    Sorry to say but your provided WP-ADMIN Login details aren’t working. Can you please share valid WP-ADMIN Login details of your Site so that we can proceed further and check the issue on your Site and assist you accordingly.

    Best Regards

Viewing 8 posts - 1 through 8 (of 8 total)