Forum Replies Created

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter abhisekpadhi

    (@abhisekpadhi)

    Also, on deleting the ” CCAvenue Payment Gateway Advanced for WooCommerce ” plugin ” Woocommerce Frequently Bought Together ” also gets deleted.

    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    Stumbled upon this old post of mine, thought of updating how I did this, in case someone comes wondering with this same question. Here is how I did it.
    1. Copy the whole woocommerce template plugin into your child theme
    /path/to/plugins/woocommerce/templates to /path/to/child-theme/woocommerce/
    2. Edit the email-order-items.php in /path/to/child-theme/woocommerce/emails
    3. Before the action hook
    do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text );

    add this code:

    $brands = wp_get_post_terms( $_product->id, 'product_brand', array("fields" => "all") );
        echo '<div class="email-brand"><p><strong>Brand:</strong>' . ' ';
        foreach( $brands as $brand ) {
            echo $brand->name . '  ';
        }
        echo '</p></div>';

    _product->id will fetch your productID and pass that as if it is post->ID to wp_get_post_terms(). <div> and <p> are for styling.

    This will output the brands list (separated with a space) of each product in woocommerce emails to customers and to store admin.

    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    @steppade – Plugin developer has probably abandoned the plugin. Anyways I’m still using. No, category and subcategory settings still don’t work. I’m using this plugin to set global rules and sometimes in some products I override the rules to custom rules. I’m also trying to fork the plugin and fix the issues. Will release it to WordPress repo once stable.

    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    Okay cool. No plugin was causing the issue. It was PHP5.6 Opcache which led the minicart and viewcart pages to produce cached content even after logout. So, I’ll be blacklisting them from Opcache and test.

    For cofnirmation, I did test with a fresh woocommerce installation and eveything worked in the fashion as Mike said. It’s probably caching that is causing the issue.

    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    It’s better for customer to have products in the cart showing after they log out and I’m completely in favour of it.

    It’s just that some customers are complaining that they don’t want their cart to show their products after logout, because they use shared computers and it’s their privacy. So, it makes sense to have cart on my website clear after customer logout.

    Solution 2 Empties the cart after logout (good), but after login customer’s cart is also emptied (bad).

    So, what do you thing best approach would be ? Leave woocommerce at its default behaviour. Or clear cart after logout. If later, how do I do it ?

    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    I’m not getting any woocommerce emails after adding that function, Where have I done wrong ?

    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    Hi Mike,
    I added this function into function.php and nothing is happening. Brands are not showing up in the email. Where did I do the mistake ?

    function add_brands_to_email () {
    
      $brands = wp_get_post_terms( $post->ID, 'product_brand', array("fields" => "all") );
        foreach( $brands as $brand ) {
        echo $brand->name;
      }
    }
    // add the action
    add_action( 'woocommerce_order_item_meta_end', 'add_brands_to_email', 10, 3 );
    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    I can get the output of Brands on a product page using the code below. But I am unable to figure out which hook to use to get the brand for each product in wocommerce email notifications. I’m on Woocommerce 2.6, WordPress latest.

    <?php $brands = wp_get_post_terms( $post->ID, 'product_brand', array("fields" => "all") );
      foreach( $brands as $brand ) {
      echo $brand->name;
    }?>
    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    Nope I’m not aggregating inline CSS, because it is breaking some css that are dynamically added by plugin and theme.

    And I’ve done some changes.

    Autoptimize settings:
    -Optimize HTML Code?
    -Optimize JavaScript Code?
    -Also aggregate inline JS? —- Unchecked (Disabled)
    -Add try-catch wrapping?
    -Optimize CSS Code?
    -Save aggregated script/css as static files?

    Found that the list of excluded js files were messed up because of 2-3 comma’s “,” at wrong place. So, I fixed that.

    Then I did a load test and crawling with a simulated browser so that autoptimize will generate the necessary js and css files for each pages, as the site is woocommerce based site and has more than 8000 products.

    Now the cache size is in control. It’s 45Mb now.

    For critical CSS I’m following this – https://www.smashingmagazine.com/2015/08/understanding-critical-css/

    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    I have already excluded them. Not only that I’ve also excluded some of other js files of 2 other plugins.

    1. Woocommerce Predictive search (backbone.min.js and backbone.localstore.js) – Excluding these files fix the search functionality
    2. Woocommerce product filter (premium plugin) js files

    Btw, I’ve just put the filname.js in the list of excluded js files like : file1.js, fil2.js, file3.js

    So, is that an issue ?

    Do i have to put like = file1,file2,file3 ….

    But excluding the files of my plugins (using file1.js, file2.js…) I do see the effect of them being excluded.

    abhisekpadhi

    (@abhisekpadhi)

    Use this css to make the icons horizontal

    .type-page img {
        padding: .53em;
        border: 1px solid #e6e6e6;
        background: #fff;
        max-width: 100%;
        height: auto !important;
        display: inline;
    }

    Hey Ewout,

    Thanks for the suggestion. I deactivated all plugins and customizations related to your plugin and checked the code syntax and dependencies and now I’m able to download the invoice and packing slip’s without any lag. As per my function, I could test that Delivery time slot and date was printed on packing slip and not on the invoice. With your code, I can get the Delivery slot and date printed on both packing slip and invoice.

    Thanks for the help.

    Hi Ewout,

    I’m using this plugin for implementing delivery slots – https://codecanyon.net/item/woocommerce-delivery-slots/7323634

    Custom fields used by this plugin are – jckwds_date (For date) and jckwds_timeslot (for time)

    And this is the code in functions.php to print the delivery slot in PDF invoice which is generated using your plugin.

    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_delivery_date', 10, 2 );
    function wpo_wcpdf_delivery_date ($template_type, $order) {
        global $wpo_wcpdf;
        if ($template_type == 'packing-slip') {
            ?>
            <tr class="delivery-date">
                <th>Delivery Date:</th>
                <td><?php $wpo_wcpdf->custom_field('jckwds_date'); ?></td>
            </tr>
    	<tr class="delivery-date">
                <th>Time Slot:</th>
                <td><?php $wpo_wcpdf->custom_field('jckwds_timeslot'); ?></td>
            </tr>
    
            <?php
        }
    }

    The code is apparently for packing-slip, so the delivery time and slot is not printed on the invoice.
    Is the code correct ? Can you verify, please.

    For past few days when I click download invoice or packing slip it is taking indefinite time to start download. I have allocated 512 MB for wordpress and php. So, no bottlenecks in server side. My site is hosted with AWS, so no issues with slow server. \

    But the invoice email generated by woocommerce contains the pdf invoice attached.

    As a result I cannot download the packing slip and test. So, I replaced teplate_type=’invoice’ and resent the customer invoice, but still the pdf invoice emailed didn’t contain the time slot.

    Let me know how can I print the delivery time slot and date in the pdf invoice and what is the issue with downloading packing-slip and invoice.

    Do I have to deactivate all plugins and remove all customizations related to your plugin and test again ?

    What do you suggest ?

    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    Thanks for the reply. I have figured, there was no theme or plugin conflict. The codes index.php in the root folder was somehow replaced by <?php //silence is golden ?>, probably by your plugin, because i didn’t do that manually, I am sure.

    Never mind, I could troubleshoot.

    I’ll give another try to your plugin and report here what specifically is causing the issue or does the problem actually lie on my end of configuration of themes and plugins. ?

    Thread Starter abhisekpadhi

    (@abhisekpadhi)

    Thanks.

    I forgot, $order_date is not being used in the function.

Viewing 15 replies - 1 through 15 (of 20 total)