New answers tagged

0

We’ve created a custom function called get_breadcrumb() to generate the breadcrumb links. You only need to add the get_breadcrumb() function code in functions.php file of the current theme. function get_breadcrumb() { echo '<a href="'.home_url().'" rel="nofollow">Home</a>'; if (is_category() || is_single()) { echo "&nbsp;&nbsp;&#...


0

Make sure you flush/re-save your settings in Permalinks > Settings whenever you add code the adds a rewrite endpoint or rule. Also, the most up to date and optimal way to add an account endpoint in WooCommerce would be to use the woocommerce_get_query_vars filter: /** * Register support endpoint. * * @param array $query_vars WooCommerce query vars. */ ...


0

i have tested below code it works properly for variation name $variationId = 39; $variation = new WC_Product_Variation($variationId); $variationName = implode(" / ", $variation->get_variation_attributes()); echo $variationName;


-1

You could use a combination of update_post_meta(), set_objetc_terms(), and wp_update_post() to update your products. It is a good idea to use taxonomies (product categories and product attributes in WooC) as extensively as possible to store common product data as it makes searching for products faster compared to storing the data in post_meta. Here's a ...


-1

use this here you get variation name $productId = 1; //product id here $handle = new WC_Product_Variable($productId); $variationData = $handle->get_children(); foreach ($variationData as $value) { $variation_id = $value; $single_variation = new WC_Product_Variation($value); $var_slug = $single_variation->slug; echo "<br/>".$name = implode(" / ", ...


0

Use the get_varation() method. If the attribute is a global attribute it will properly get the name from the taxonomy term for the attribute, and if it's not it will return the value stored with the product. $product_variation = wc_get_product( $variation['variation_id'] ); echo $product_variation->get_attribute( 'size' );


-2

Please try below code. it will output a variation name of attribute size by variation id. $variation = wc_get_product($variation['variation_id']); $variation_attributes = $variation->get_variation_attributes(); $variation_name = ucfirst($variation_attributes['attribute_pa_size']); echo $variation_name; let me know if this works for you.


-1

This isn't a simple UI change, as pointed out above. If you wanted to develop something I think you would start by creating your own payment gateway. For example, a buyer could choose to pay for an item by credit card, Paypal or Points. You can find out more about creating your own gateway HERE. Also, there are a couple plugin options that seem pretty ...


0

fortunately ftp server had install nginx and i used x-accel-redirect inside downlod server to solve my problem. thanks for your helps:)


0

<?php if ( is_front_page() && is_home() ) { // Default homepage echo "Default homepage"; } elseif ( is_front_page()){ echo "Static homepage"; // Static homepage } elseif ( is_home()){ echo "Blog page"; // Blog page } elseif ( is_page( 'cart' ) || is_cart())...


0

Dang it...must be blind....FOUND IT. The solution is, that since this is a custom hook, and most likely using JQuery, you place the end point action within the call. Instead of this: function mylistings_information_endpoint_content() { echo 'THIS IS A TEST OF THE CONTENT'; } add_action( 'woocommerce_account_information_endpoint', '...


0

This isn't possible currently with what you've got. Tags or Taxonomies in WordPress can only bad attached to a post once. And are completely ignorant of the content in a post they are attached to. However, it shouldn't be too difficult to write a function to count the times a tags name is used in the content of a post. First, we need to run our counting ...


0

I solve this problem it's too easy just paste the code in function.php and the code do not remove the default searching by title. See The Example with screenshots First, add your Custom Field Group with Post Type is equal to Product and add a new field with field label and field name as like Add some text in the custom field that shows in the product ...


1

One approach would be to override woocommerce/templates/emails/email-order-items.php (and possibly the version for plain-text emails) with your own version. It has access to $sent_to_admin, so you could replace its call to echo wp_kses_post( apply_filters( 'woocommerce_order_item_name', $item->get_name(), $item, false ) ); with your own.


0

You can use WooCommerce Stock Manager plugin for that. Also, there is another plugin called Woo Excel-like Price Manager but it's deprecated I think.


0

You seem to have an unexpected "/" character here .../>%5$s</option> so the "option" tag is: <option ... />Collection</option> instad of <option ... >Collection</option> I am not sure if this causes a problem but i think it is worth checking :).


1

Add This Code In function.php then save it. After Changes, You can see the changes in the screenshots function search_by_sku_for_admin( $search, &$query_vars ) { global $wpdb, $pagenow; if ( 'edit.php' != $pagenow || empty($search) ) { return $search; } $args = array( 'posts_per_page' => -1, 'post_type' ...


0

Finnaly i've done this in my archive-product.php if (is_search()) wc_get_template_part( 'content', 'product-custom' ); else wc_get_template_part( 'content', 'product' ); I don't know if its the right way but it works. Thanks for your help @Kuliraj


1

You can nest your tax queries. Just make sure you use OR as the first relation and AND relation on the nested tax queries. $filter_group_a = array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $term_a, ), array( 'taxonomy' => 'product_cat', 'field' => 'slug', ...


0

If you need to be able to add or remove an amount from standard prices at any time, you could add a custom field to WooCommerce's settings pages, then modify the price of your products using the built-in filter. Here is how I would do it: (this would go in your theme's functions.php file) /** * Add a new tab to WooCommerce settings pages **/ function ...


0

you can nest multiple tax queries like so: $query_args = array( 'post_type' => 'product', 'tax_query' => [ 'relation' => 'OR', [ [ 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $x_y, 'operator'...


0

function remove_sidebar( $is_active_sidebar, $index ) { if( ! is_product() ) { return $is_active_sidebar; } return false; } add_filter( 'is_active_sidebar', 'remove_sidebar', 10, 2 );


0

You would need to override the /myaccount/my-orders.php template file. Using your code to add 'target' => '_blank' to $actions['parcial'], I would edit this part of the template to look something like this: $actions = wc_get_account_orders_actions( $order ); if ( ! empty( $actions ) ) { foreach ( $actions as $key => $action ) { echo '<...


0

Here is my answer and it's working perfectly. function conditionally_remove_checkout_fields( $fields ) { // HERE the defined product Categories $categories = array('age-defying-skincare','az-brand-accessories','az-healthy-supplements','az-other-natural-products','Not available mwb_wgm_giftcard','little-geniuses-children'); $found = false; ...


0

Not too sure what this stripe stuff is but you can see the emails WooCommerce will be sending if you go to this url - /wp-admin/admin.php?page=wc-settings&tab=email Or was it something more specific than this? :S


0

Your prayers have been answered - https://wordpress.org/plugins/rearrange-woocommerce-products/ Thanks, Jason.


0

I found these were custom fields set up within the functions.php file. Thanks, Jason.


0

I got same issue a few days ago. I figured out that the problem was in my theme. How did I knew that. I disabled all the plugins and tried again but the problem still there so I connected my hosting to help me and they just whitelisted my IP-addresse in Security Mode but the problem still there so I switched to the Twenty Fifteen theme and it's worked. So ...


0

This case is possible with FedEx WooCommerce Shipping with Print Label. All you need is the following free add-ons and the code below. Hide WooCommerce Shipping Methods based on Shipping Class and Zones Skip Shipping calculation based on WooCommerce Shipping Class These free plugins as well as, a similar case is already explained very well in the ...


0

Was the order moved from Pending to Cancelled? WooCommerce no longer sends an email to the admin for that (I think the logic is that a lot of bot-created Pending orders were automatically cancelled and giving admins too many notifications). You can restore the old behavior by hooking woocommerce_order_status_pending_to_cancelled_notification and calling WC()-...


0

if( is_home() || ! $ed_section || ! ( is_front_page() || is_page_template( 'template-home.php' ) ) ){ echo '<div class = "container"><div id="content" class="site-content"> <div class="tab1"> <a class="cat_button" href="https://packnchew.com/product-category/appetizers-snacks/">Appetizers & Snacks</a> <a class="...


0

Can you use WooCommerce conditional tags instead of the default? For example, if you want this block of content to appear for all pages, use is_woocommerce() or if it should only appear on the main shop page, use is_shop(). For example: if( is_woocommerce() ){ //echo your content here... } ?> Source: https://docs.woocommerce.com/document/...


1

Apparently Woocommerce need a local path and not a URL to the file. In order to fix I used this: function attach_order_notice ( $attachments, $email_id, $order ) { // Only for "New Order" email notification (for admin) //if( $email_id == 'new_order' ){ $file_path = wp_upload_dir()['path']; $file_name = get_field( '...


0

I think you can detect order status change and store the current order total to be used as negative fee so that it can be deducted from order total before calculating total. To make it less confusing the code should be something like this: add_action('woocommerce_order_status_changed', 'add_credit_fee_if_editing', 10,3); function add_credit_fee_if_editing($...


0

The problem is this line: $cat_info = get_term_by('slug', $cat, 'product_cat'); You're trying to get a category by slug, but $cat is undefined, so $cat_info is false, which means that this line: $l_name = trim($ctitle) != '' ? $ctitle : $cat_info->name; Is throwing the first error, because you can't access ->name on false. And on this line: $...


0

Booking is custom post type and not the default woo-commerce set up, you need to modify your post type's screen hook accordingly and fetch order details via particular id to show it, it can not be done directly from woo-commerce or it's hooks.


-1

Use only $axy instead of 'terms' => array(var_dump($axy) ), ... It will work, surly. Try it. 'terms' => $axy,


0

Are you using a theme that has WooCommerce support? Look for: woocommerce_get_product_thumbnail and replace it with the_post_thumbnail This has worked before for me with A3 Lazy Load plugin.


0

Please try to use following code add_filter( 'aws_title_search_result', 'my_aws_title_search_result', 10, 3 ); function my_aws_title_search_result( $title, $post_id, $product ) { $text1 = get_post_meta( $post_id, '_tyre_size_field', true ); $text2 = get_post_meta( $post_id, '_load_speed_field', true ); $text3 = get_post_meta( $post_id, '...


-2

For all of those who want to use plugin instead, I created it: Increase Product Variation Limit For Woocommerce


0

Your script should looks like this. function js_enqueue_scripts() { global $post; $text2 = get_post_meta( $post->ID, '_load_speed_field', true ); $text3 = get_post_meta( $post->ID, '_tyre_brand_field', true ); $text4 = get_post_meta( $post->ID, '_brand_model_field', true ); $text5 = get_post_meta( $post->ID, '_run_flat_field',...


0

Usually there is a comment at the start of each WC template file, which basically says: This template can be overridden by copying it to yourtheme/woocommerce/wc-template-name.php.. This is the correct and recommended way to override WooCommerce templates. I think you should look into having a child theme for when there is a theme that already have those ...


0

You can use custom functions.php file inside your theme folder. If a file named functions.php already exist, then you can use the following formulae. You can also create a functions.php file by yourself in the theme root folder if it does not exist. <?php /* Functions.php file Description: Site specific codes and functions */ function ...


0

I search to do that and finally found a solution.You can do something like that: This implies that your products have a repeater field "tabs" that contains a subfield "title" and a subfield "content". add_filter( 'woocommerce_product_tabs', 'prefix_other_products_tab' ); function prefix_other_products_tab( $tabs ) { global $product; $...


0

To add another order notes custom fields : add in functions.php : /** * add new order note field */ add_filter( 'woocommerce_checkout_fields' , 'customizing_checkout_fields', 10, 1 ); function customizing_checkout_fields( $fields ) { // Define new custom Order Notes field data array $customer_note = array( 'type' => 'textarea', ...


0

Alternatively you can use my plugin and adjust the product permalinks directly from Wordpress admin dashboard. Firstly, you need to install Permalink Manager Lite from Wordpress Plugin Directory. Then you need to go to "Tools -> Permalink Manager -> Permastructures" admin page and scroll down to "Products". Now, you should replace the default permalink ...


1

Disclaimer: this is clumsy, someone might have a better suggestion. But here's one idea: Leave WordPress configured with your support@mydomain.com settings. Set up Woo with the sales@mydomain.com address (WooCommerce -> Settings -> Emails -> From Address). Hook woocommerce_mail_callback with your own function that temporarily hooks phpmailer_init to change ...


0

finally found the solution when i enter all the custom post status to public it declare the post_type to default post as global so applied filter to change the global post_type based what type request get in URL function publishPress_allPost_pre_get_posts( &$wp_query ) { if ( is_admin() && array_key_exists( 'post_type', $_GET ) ) { $...


0

Most importantly - hide_empty => true Look in the codex for possible args for get_terms: https://developer.wordpress.org/reference/classes/wp_term_query/__construct/


0

Why get_attribute()? Maybe you're looking for get_title()? This would retrieve the variation's name.


Top 50 recent answers are included