Forum Replies Created

Viewing 15 replies - 16 through 30 (of 55 total)
  • Thread Starter carver1g

    (@carver1g)

    Thanks for your quick reply.

    I have opened the Developer Console and see no js errors. Debug log shows nothing. One thing I noticed is the first product I add to the cart the edit works first time and works well. If I add an additional product the cart and need to edit the name this is when the delay happens and I have to update multiple times before it takes.

    I am developing this site on localhost if that makes a difference.

    Thanks for your help and a great plugin.

    carver1g

    (@carver1g)

    Place this in functions.php file:

    function custom_override_checkout_fields( $fields ) {
     $fields['billing']['billing_first_name']['autofocus'] = 'false';
      $fields['shipping']['shipping_first_name']['autofocus'] = 'false';
        return $fields;
    }
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    Thread Starter carver1g

    (@carver1g)

    Nevermind, got things working. Solved.

    cbhurji,

    Follow up to my last post. If the positioning (margin-bottom) works and you wish to use the color of your top menu as the background, make the background of the topbar transparent and adjust the color of the font accordingly depending on the top menu’s background color.

    cbhurji,
    Place the css in your child’s theme style.css. It may be possible to ‘appear’ that this top bar is part of the top menu by using a negative bottom margin e.g. ‘margin-bottom: -30px’ or whatever amount it takes to line up with the top menu.

    #topbar{
    background-color: #333333;
    height: 30px;
    line-height: 30px;
    overflow: visible;
    clear: both;
    margin-bottom: -30px;
    }

    You could create a top bar which will display the logged in user’s name. This is the code I use in my child theme:

    /**
    * Adds a top bar to Storefront, before the header.
    */
    function storefront_add_topbar() {
    global $current_user;
    wp_get_current_user();
    if ( ! empty( $current_user->first_name ) ) {
    $user = $current_user->first_name;
    } else {
    $user = __( 'guest', 'storefront-child' );
    }
    ?>
    <div id="topbar">
    <div class="col-full">
    <div class="welcome">
    <p style='font-family:helvetica,tahoma,arial; font-size:16px; font-weight: 500; color:#FFF!important;'>Welcome <?php echo $user ?>!</p>
    </div>
    </div>
    </div>
    <?php
    }
    add_action( 'storefront_before_header', 'storefront_add_topbar' );

    I then styled it as follows:

    #topbar{
    background-color: #333333;
    height: 30px;
    line-height: 30px;
    overflow: visible;
    clear: both;
    }

    .welcome{
    max-width: 250px !important;
    height: 25px !important;
    text-align: left;
    margin-top: 0px !important;
    clear: none;
    }

    Of course you can style it any way you like. Don’t know if this is what you are looking for.

    Place this in functions.php:

    remove_action('admin_notices', 'woothemes_updater_notice');

    Thread Starter carver1g

    (@carver1g)

    @stuartduff

    Thanks, appreciate your quick reply and help.

    Thread Starter carver1g

    (@carver1g)

    Seems to have done the trick!

    Greatly appreciate your help.

    Thread Starter carver1g

    (@carver1g)

    Will do. Will let you know the outcome.

    Thanks

    Thread Starter carver1g

    (@carver1g)

    Thanks for your reply. Here’s a link to the screenshot.

    screenshot

    This is what I use in functions.php

    add_filter( 'storefront_loop_columns', 'sf_child_products_per_row' );
    function sf_child_products_per_row() {
        return 4;
    }
    Thread Starter carver1g

    (@carver1g)

    seank123,

    It’s possible I got a white screen at first trying your suggestion because I was missing “$all_fields = apply_filters( ‘wccpf/load/all_fields’, $product_id );” in the original code. I added the “$all_fields…” and your original suggestion and now the code works!

    I found these notices in the debug.log:

    PHP Notice: Undefined variable: product_id
    PHP Notice: price was called incorrectly

    Had to add a couple of things to this code to avoid notices in the debug log. Here is my modified code along with my annotations:

    unction calculate_cart_total( $cart_object ) {
     
        $additionalPrice = 3;
    
        $product_id = get_the_id();  //this corrected the undefined variable notice
         
        foreach ($cart_object->cart_contents as $key => $value) { 
    
         $all_fields = apply_filters( 'wccpf/load/all_fields', $product_id ); //missing in my original code
                      
            if( isset( $value["wccpf_logo_1"] ) && ( $value["wccpf_logo_1"] == "rose"||$value["wccpf_logo_1"] == "football"||$value["wccpf_logo_1"] == "baseball"||$value["wccpf_logo_1"] == "basketball")){
    
             $orgPrice = floatval($value['data']->get_price()); //this corrected the price called incorrectly notice
    
             $value['data']->set_price($orgPrice+$additionalPrice); //thanks to you
          }               
       }
    }
    add_action( 'woocommerce_before_calculate_totals', 'calculate_cart_total', 99 );

    I hand carve logos on cedar boxes I sell, that’s why the “wccpf_logo_1”.

    Been pulling what little hair I have left out for the past month trying to get this code to work again. Don’t know how you figured that one out but thanks to you it works. Well done!

    Thread Starter carver1g

    (@carver1g)

    I’ll give it a try and see what happens. Will let you know.
    Thanks

Viewing 15 replies - 16 through 30 (of 55 total)