Jason Wong
Forum Replies Created
-
I finally found the culprit that prevented the product’s permalink from not displaying its full path.
Apparently, I had been using WP Category Permalink to select the main category for every product. Unfortunately, this plugin seems to block your plugin from rewriting the product’s permalink, thus not removing the “shop” slug.
In the end, I’ve to get rid of WP Category Permalink, and make use of Yoast SEO to set the main category for the products.What a relief !! (^_^)
I managed to figure it out. Please ignore my submitted General Inquiry, which I recently sent.
The following is what I implemented to my “custom.js” within my active child theme.
jQuery(document).ready(function($) { /* Prevents mobile menu from closing when input search is focused */ document.getElementById('menu-item-search').addEventListener('click', function(e) { e.stopPropagation(); }); });
The ‘menu-item-search’ ID was previously inserted through functions.php, using the snippets below.
// Add Search via shortcode function bb_search_shortcode() { ob_start(); FLTheme::nav_search(); return ob_get_clean(); } add_shortcode( 'bb_search', 'bb_search_shortcode' ); // Add Search shortcode to Primary Menu function bb_add_search_to_primary_menu( $nav, $args ) { if ( $args->menu == 'primary' ) { $nav .= '<li id="menu-item-search" class="menu-item">' . do_shortcode( '[bb_search]' ) . '</li>'; } return $nav; } add_filter( 'wp_nav_menu_items', 'bb_add_search_to_primary_menu', 10, 2 );
I hope this may help someone else. v(^^)v
Thanks @premmerce
Your suggestion partially achieved what I was looking for, as the products’ permalink was not a full path.
Hi @premmerce
Thanks for responding. So far, your plugin has helped to remove the “Shop” slug from Category links, but sadly not so from Product links.
Kindly refer to the development site, ohara.theartgallerypg.com, which has two category pages – Artists, Publications.
Thanks in advance.
@elitexcoder You’ll need to duplicate the “email-styles.php” file from this plugin to the “/woocommerce/emails” of an active theme (preferably a child theme).
You can then edit “active-child-theme/woocommerce/emails/email-styles.php” through wp-admin Appearance > Theme Editor. The approach I took is to view the source of the test emails, copy and paste them entirely into Dreamweaver. From there, I know which elements need to be altered, and/or added.
Base, background, body background and text colors are found in “email-styles.php”
$bg_darker_10 = wc_hex_darker( $bg, 10 ); $body_darker_10 = wc_hex_darker( $body, 10 ); $base_lighter_20 = wc_hex_lighter( $base, 20 ); $base_lighter_40 = wc_hex_lighter( $base, 40 ); $text_lighter_20 = wc_hex_lighter( $text, 20 ); $text_lighter_40 = wc_hex_lighter( $text, 40 );
$base = Base color
$bg = Background color
$body = Body background color
$text = Body text colorThe above settings are through wp-admin’s WooCommerce > Settings >> Email – Email template
Hope this helps.
Forum: Plugins
In reply to: [YITH Request a Quote for WooCommerce] Item Price column not included- Next, duplicate the “request-quote.php” file from the templates/emails folder, to the woocommerce/emails folder within a child theme.
- Add after line 22,
<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Price', 'yith-woocommerce-request-a-quote' ); ?></th>
- Then, add after line 39,
<td scope="col" style="text-align:left;"><?php echo WC()->cart->get_product_price( $_product ); ?></td>
Forum: Plugins
In reply to: [YITH Request a Quote for WooCommerce] Item Price column not includedI figured out the solution for myself, and did the following.
- Duplicate the “request-quote-view.php” file from the templates folder, to the woocommerce folder within a child theme.
- Add after line 21,
<th class="product-price"><?php esc_html_e( 'Price', 'yith-woocommerce-request-a-quote' ); ?></th>
- Then, add between lines 142 and 144,
<td class="product-price" data-title="Price"> <?php echo apply_filters( 'yith_ywraq_product_price', WC()->cart->get_product_price( $_product ), $product_id ); ?> </td>
- Finally, change line 146, from
colspan="5"
tocolspan="6"
Forum: Plugins
In reply to: [Yoast SEO] Compatibility with WooCommerce 3.2.6Thanks, Michael. Unfortunately, the website has been heavily customised and it’ll be very difficult to update WooCommerce to its current version. That’s why I’m looking for Yoast plugin’s previous version that is compatible to the WooCommerce version I’m currently using.
Anyway, once again thank you.
@riaanknoetze Looks like the CSS idea is the only way forward. I already have a snippet that enqueues a custom admin style.
/* Enqueue Admin Custom style (to be called after all styles) =============================================================== */ function admin_custom_style() { wp_enqueue_style( 'admin-custom-style', get_stylesheet_directory_uri(). '/admin.css' ); } add_action( 'admin_print_styles', 'admin_custom_style' );
Then, I’ve inserted the following styling codes into admin.css
/* WooCommerce: Order Preview * Billing Address: hide all Anchor, and first 2 Strong tags --------------------------------------------------------------- */ .wc-order-preview-address:first-child a, .wc-order-preview-address:first-child strong:nth-of-type(1), .wc-order-preview-address:first-child strong:nth-of-type(2) { display: none !important; }
After this, I’ve to clear the web browser’s cache.
I hope there’s a different approach to resolve this.@riaanknoetze A snippet example will be greatly appreciated, although I don’t quite favour the using of CSS to hide the class. Unfortunately, there isn’t any class associated to neither of the fields.
Thanks in advance. ??
@riaanknoetze You’ve missed my point.
It isn’t the admin order column, but the order preview that pops up after one clicks on the eye symbol.Hi Ewout,
I thought of using the “woocommerce_get_order_item_totals” filter at first, but it was complicated and it didn’t fully solve my problem. Eventually, I found that the “wpo_wcpdf_raw_order_totals” filter was the way forward.
I noticed your plugin doesn’t generate a REFUND PDF Invoice whenever any order is cancelled for a refund. I could probably add a condition to “invoice.php”, which can make the switch.
Hi Ewout,
I managed to develop a solution to my problem, by inserting a custom wpo_wcpdf_raw_order_totals filter into template-functions.php
The following snippet will change the tax label in the PDF Invoice according to the order’s creation date. If it was created before 01 June 2018, then it sets to “GST (6%)”. Else, it sets to “GST (0%)”./* Rename tax label of PDF Invoice =============================================================== */ add_filter( 'wpo_wcpdf_raw_order_totals', 'wpo_wcpdf_raw_order_totals_change_tax_label', 10, 2 ); function wpo_wcpdf_raw_order_totals_change_tax_label( $item_totals, $order ) { // get order details $order_data = $order->get_data(); // get order date_created data as date('Y-m-d') format $order_date = $order_data['date_created']->date('Y-m-d'); // get name tax set by the woocommerce_countries_tax_or_vat filter $gst_name = WC()->countries->tax_or_vat(); // if order date_created is before 01 June 2018, set GST string to GST (6%) if ( $order_date < date('Y-m-d', strtotime('01 June 2018')) ) { $gst_string = 'GST (6%)'; } else { $gst_string = $gst_name; } $item_totals['tax']['label'] = $gst_string; return $item_totals; }
I needed this because whenever a customer re-downloads the PDF Invoice, those orders before 01 June 2018 will display the wrong GST percentage. This solution is custom fix for me, which I hope can be helpful to others.
Hi Ewout,
In the get_woocommerce_totals() function, I found the following lines of code
if ( 'itemized' == get_option( 'woocommerce_tax_total_display' ) ) { foreach ( $this->order->get_tax_totals() as $code => $tax ) { $tax_amount = $tax->formatted_amount; $tax_string_array[] = sprintf( '%s %s', $tax_amount, $tax->label ); } } else { $tax_string_array[] = sprintf( '%s %s', wc_price( $this->order->get_total_tax() - $this->order->get_total_tax_refunded(), array( 'currency' => WCX_Order::get_prop( $this->order, 'currency' ) ) ), WC()->countries->tax_or_vat() ); }
Since my setup isn’t displaying tax for each item (not itemized), it executes the ELSE statement. Hence, it displays the current tax rate via WC()->countries->tax_or_vat(). I’m trying to figure out how to get an existing order’s tax rate instead when the [PDF Tax Invoice] button is clicked.
If the woocommerce_countries_tax_or_vat filter is disabled, then it reverts to “tax”.