Support

Account

Home Forums Search Search Results for 'woocommerce'

Search Results for 'woocommerce'

reply

  • i dont know what it has to do with acf but check defaults on get_posts() it has publish as default post_status. Do you have published products?

    Also is products the post_type from WooCommerce or is it a self registered? Is it correctly registered an you have product posts published?

  • Thank you John, I realise you are trying to help.

    I’ve set up a Field Group containing fields for additional book information (e.g. publisher, publishing year, author, Title, edition no., etc.) which is tied to woocommerce products. Everything works fine woocommerce, wise, etc. but I also need to create and advanced search page or section where customers can search for books.

    Above I’ve explained the issue and you are clearly right when you say the issue WP (its search) splits a string into words but this doesn’t seem to be the case with ACF. I’ve tried various plugins for filtering, inc. JetSmart Filters, Filter Everything, Product Filter by WooBeWoo, etc. but the issue remains. When trying to search via the Author custom field, the search only works with EXACT match, which is kind of a disaster from my point of view.

    I am just surprised that I haven’t found anyone else having the same problem. I would have thought with the amazing capabilities of ACF, someone would have come up with a way to build a search page where you’d be able to change the conditional logic, etc. And that you would have the option to decided whether you want an EXACT match or partial match on a custom field string. Is this a limitation of ACF perhaps?

    Anyhow, thank you for your time and effort and sorry if I am being too much of a newbie.

  • I am new to ACF and loving it, but the learning curve is considerable.

    I am setting up a website for a client to sell second hand books. Once the site is up I will have to import a large database of over 20K+ books.

    I am using ACF to add additional information to the books as woocommerce products, e.g. ISBN, Author, Publisher, Book Condition, etc. The trouble I’ve run into is this:

    I am setting up a custom search/filter page and it works however I’ve noticed that searching/filtering in relation to the Author custom filed only works (produces a result) if an EXACT match is entered. E.g. if the author is ‘Douglas Adams’ his books only show up if searching for/filtering with an exact match, but not if ‘Adams’ alone is entered. This is a problem as most customers will likely just type a surname in to find books by an author, not to mention that about 80% of the author names in the database follow a ‘surname, firstname’ convention. E.g Douglas Adams might have been entered into that database as ‘Adams, Douglas’.

    Is there a way of modifying this behaviour? What do I do?

    Any helps/comments would be much appreciated and like I said, I am a newbie so perhaps I am just missing something obvious?

  • I am using WooCommerce Memberships and WooCommerce subscriptions. I’m not sure if there is a hook but I’ll look at the documentation and see if I can find something.

  • Use a textarea field

    here is some documentation I found https://www.commercegurus.com/woocommerce-acf/

  • WordPress will set related products to that main product automatically based on tags , category etc. But if you want to add custom related products then this guide have shown a method on how to do it.
    Once you open this article scroll down below and there you will see change/add related products. So follow the steps mentioned in this method and in this way you can add custom related products

  • Hi,
    I have some issue regarding sorting using ACF field
    In Woocommerce product I have added one ACF group named product_shipping_and_installment and inside this group one field named product_type in this field user will add “AC” Or “CO”.
    Below is the code:

    
    $args = array(
        'post_type'      => 'product',
        'posts_per_page' => -1,
        'post_status' => "publish",
        'product_cat'    => $cat->name,
        'meta_query'	=> array(
            'relation'		=> 'AND',
            array(
                'key'		=> 'product_shipping_and_installment_product_type',
                'value'		=> array('AC', 'CO'),
                'compare'	=> 'IN'
            ),
        ),
            
    );
    $loop = new WP_Query($args);
    

    Above screenshot code will provide me all the list of product based on field named product_type but not sorting wise. I would like to show “AC” value product list first and then need to show “CO” product list currently is showing me “CO” product list first and then “AC” product list.
    Any help is greatly appreciate.
    Thanks 🙂

  • Thanks for your help. I fixed the code as you suggested, but the same error shows:
    Warning: Cannot modify header information – headers already sent by (output started at /home/customer/www/bermelloajamil.com/public_html/wp-content/themes/bifrost/header.php:1) in /home/customer/www/bermelloajamil.com/public_html/wp-includes/pluggable.php on line 1421

    Here is a snippet of the fixed code:

    <?php
    if (get_field(‘general_redirect’, $bifrost_queried_object) && get_field(‘general_redirect_url’, $bifrost_queried_object)) {
    wp_redirect(get_field(‘general_redirect_url’, $bifrost_queried_object));
    exit;
    }
    ?>
    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset=”<?php bloginfo(‘charset’); ?>”>
    <meta name=”viewport” content=”width=device-width, initial-scale=1″>
    <meta http-equiv=”X-UA-Compatible” content=”ie=edge”>
    <?php
    /**
    * Queried Object
    *
    * In case it is shop page get_queried_object won’t
    * work, it needs to be changed to a custom WooCommerce
    * function wc_get_page_id.
    */
    $bifrost_queried_object = class_exists(‘WooCommerce’) && is_shop() ? wc_get_page_id(‘shop’) : get_queried_object();

    wp_head();
    ?>
    </head>

    Thanks so much for your help!

  • Hi,
    I have some similar issue
    In Woocommerce product I have added one ACF group named product_shipping_and_installment and inside this group one field named product_type in this field user will add “AC” Or “CO”.

    Below is the code:

    
    $args = array(
        'post_type'      => 'product',
        'posts_per_page' => -1,
        'post_status' => "publish",
        'product_cat'    => $cat->name,
        'meta_query'	=> array(
            'relation'		=> 'AND',
            array(
                'key'		=> 'product_shipping_and_installment_product_type',
                'value'		=> array('AC', 'CO'),
                'compare'	=> 'IN'
            ),
        ),
            
    );
    $loop = new WP_Query($args);
    

    Above screenshot code will provide me all the list of product based on field named product_type but not sorting wise. I would like to show “AC” value product list first and then need to show “CO” product list currently is showing me “CO” product list first and then “AC” product list.
    Any help is greatly appreciate.
    Thanks 🙂

  • From WooCommerce Product Vendors v2.1.55

    * Add – New action on Vendor Profile screen, wcpv_vendor_settings_render_additional_fields, to enable other plugins to add additional settings fields.

    So now it seems that could be done.

    But how? Could you please share the code? I’m having some trouble with this.

    Tks

  • Hello @girldetective

    Unfortunately it was not resolved by ACF support. I still have the same problem.

    Support reported that this issue is from WooCommerce and not ACF.

  • How did this turn out? I wish it had been public so I could see, because I’ve experienced the same thing with wc_get_template_part()– it renders an empty block, but if you switch to Preview mode and back to Edit, the block renders fine. It works fine on the front end, of course. If I just individually call for the_title, the_content, the_post_thumbnail, for example, it works perfectly on the back end, but I obviously want all the woocommerce goodies like price etc.

    It’s been this way for quite a while but it’s not a showstopper since you can toggle preview/edit.

  • Hey John, thank you for helping me out with this.

    Buddy of mine who’s more experienced in development helped me out already. And here was the final code being used now:

    function sd_loop_product_cat_note() {
    	// Get the category terms
    	$terms = get_the_terms( $post->ID, 'product_cat' );
    	
    	// Only proceed if there is at least 1 category
    	if ( $terms && ! is_wp_error( $terms ) ) {
    	
    		// Get the first term
    		$first_term = $terms[0];
    		 
    		// Get the product note for that term
    		$sd_loop_item_suffix = get_field( 'sd_product_archive_suffix', 'product_cat_' . $first_term -> term_id );
    	
    		// Output the product note
    		echo $sd_loop_item_suffix;
    	
    	}
    	
    }
    
    add_action( 'woocommerce_after_shop_loop_item', 'sd_loop_product_cat_note', 5 );

    This code displays the needed ACF field value in the Shop loop and Category loop in my website. (^_^)

  • Hi,

    Can we apply the same method on this plugin products by attributes & variations for woocommerce for the products tabs.

  • I’m having the same problem. I have created 2 rules for an advance custom field to only appear on products and those that equal a specific category. Like yourself, it functions as expected with woocommerce for the admin side but not with dokan for the seller upload form. The field is appearing despite my conditions set.

    I only want this field group to show on Dokans seller product upload if they’ve selected a particular category.

    I’m quite new to all this so assume you’re talking to simpliest person lol. Any help gratefully received

  • OK – simpler to add the shortcode directly into the .html template, just like WooCommerce works.

    Woo adds an entry directly into the wp_posts data table for their pages. The post_content field is a shortcode….

    <!-- wp:shortcode -->[woocommerce_cart]<!-- /wp:shortcode -->

    As I want to surround my block contents with my ACF extracted data I can put this markup directly into my templates.

  • You will need to give more details.

    What type of field are you using?

    What do you mean by

    “I would like the category of woocommerce products to be added automatically”

  • Sorry if my reply was “cryptic”.

    ACF is built for developers, when I say “developers” I mean people that code in PHP and are able to modify the templates and code in a theme to use the fields. ACF is an admin tool that makes creation of fields in the admin easier for the developer and give the editor a nice UI to use to add content to these fields.

    What code to use? Every field is explained in the documentation and has example code for use in your theme.

    Where does the code go? This is highly dependent on your theme. For a theme that you build, if you are familiar with how to build a theme then this is most likely self explanatory. The code goes in the theme template where you want the value of a field to be shown. If you are attempting to modify an existing theme then you need to figure out where this is. It may require editing one of the existing theme templates. It might require using action/filter hooks provided by the theme. Again, if you are familiar with building and/or modifying themes then you likely already have some idea of what this means. When using filters to add or modify content then these filters will generally be added to your functions.php file.

    As an example let’s look at WooCommerce. WC is a plugin that includes many template files as well has hooks that can be used for showing additional content or modifying content that is displayed. Templates can be overridden by copying template files to your theme. WC also has many hooks that are available to use. If you override a template then you can output ACF fields by modifying those templates. If you are using filter or action hooks then you would add your filters and actions to your functions.php file.

    Even in the case of a tool like “Loops & Logic” given by @richardu you still need to be able to do the coding to use it.

    ACF is not generally as useful if you do not have the ability to modify templates and do the PHP coding necessary to use the fields that ACF creates. It is not really meant for those that use “Theme Builders” or “Theme Frameworks” unless you have the ability and understanding of how to add custom code to these things. For those that want to use these tools and not do the coding needed there are other tools available for this purpose, like “Pods” and “Toolset”.

    There are simply too many possibilities for ACF to be able to explain how to use fields in every theme, plugin, builder and framework that is available. Getting help here on these things will depend on some other user that participates in this forum knowing how to do so. In most cases you need to talk to the developers of these other things. I you can figure out how to use a standard custom WP field in those other things then you can use ACF by replacing the code used for using those fields with ACF coding. If you can figure out how to use a custom field in these other things then you are more likely to get help here on how to modify that to use ACF fields.

  • Hey,
    Seems like this bug still occurs with latest WC version.

    Advanced Custom Fields PRO 5.12
    WooCommerce 6.3.1 (still using their SelectWoo stuff…)

  • Thanks a lot John! This kind of input is so much of value, as it’s important to know what to do before figuring out how to do it.

    I discussed this with someone else as well and she suggested even a complete other approach by using WooCommerce attributes instead of CPT and instead of a custom taxonomy. Many opportunities out there.

    Thanks for explaining

  • I can’t edit my reply so I have to write a new one. I’ve checked into database, and I saw that the custom field date_end is saved in the following format:
    02/April/2022
    So I’ve tried to manipulate and change the code:

    add_filter('woocommerce_get_catalog_ordering_args', 'woocommerce_catalog_orderby');
    function woocommerce_catalog_orderby( $args ) {
        // <- define category slug- returns true or false
            $args['order']    = 'ASC'; // <- order ASC or DESC
            $args['meta_key'] = 'date_end'; // <- _price is meta_value_num's key - required'
            $args['orderby'] = date('Ymd', strtotime(preg_replace("/\//", " ", 'meta_value')));
    
        return $args;
    }

    But again, I don’t have correct ordering.

  • Hi everyone,

    I am having the same issue. All import is good at backend but the shortcode info on front end is not showing if i not update each post manually :S

    I am importing woocommerce products with meta value, nothing all.

    Thank you

  • yes woocommerce fields, but the variables from their documentation don’t work inside the loop I’m using

  • If they are ACF fields

    
    $custom_field = get_field('field_name', $featured_post->ID);
    

    if they are fields associated with something else, like WooCommerce then you will need to refer to their documentation for getting these values.

  • No, ACF cannot be added. Woocommerce probably has documentation on how to add a settings tab, I did not find that but I did find a tutorial on doing it https://www.speakinginbytes.com/2014/07/woocommerce-settings-tab/

Viewing 25 results - 401 through 425 (of 889 total)