Support

Account

Home Forums Search Search Results for 'woocommerce'

Search Results for 'woocommerce'

topic

  • Unread

    Taxonomy terms missing from location rules after changing the slug

    I added ACF custom fields to WooCommerce products and assigned them according to their taxonomy terms (product_cat).
    Everything was working fine, but when I changed the slug of some terms the location rules disappeared. And when I wanted to reassign them these terms were no longer in the location rules dropdown.

    These terms are still present because they are selectable in another ACF rule (see image).

    Each time I modify the slug of a term, it disappears from the Taxonomy list of the ACF rules.
    I guess I’m not the only one to have encountered this problem, but I haven’t found anything in my research. Is it an ACF bug or a problem on my side?

    Thanks,
    Laurent Leruste

  • Solving

    Display Custom Field on Product Category Page

    I added a custom field to the product category page. It’s a Wyswig field. I can’t seem to figure out how to display the field on the page.

    I’ve edited the product-archive.php file and placed the following code before the woocommerce_product_loop_end(); hook

    $value = get_field( 'bottom_description', 8 );
    	echo $value;

    I’ve also tried adding a hook in the functions.php file.

    add_action( 'woocommerce_after_shop_loop', 'prodcatdesc' );
        function prodcatdesc() {
            echo the_field('bottom_description');
        }

    How can I get this to work?

  • Unread

    One Form, Multiple Power

    I want to create a Form that will be used to Post all Types of Contents– Posts, Image Gallery,Portfolio Post Types, WooCommerce and so on.

    There’s this plugin called ACF Frontend Form for Elementor(https://www.frontendform.com/) and it needs Elementor Page Builder and Advanced Custom Fields installed for it to work.

    REQUIREMENTS
    I need the Form to be a dynamic Form in such a way that it will be one Form that will be responsible for making all uploads and postings.

    1.) How it works is this–It will be called Submission Form. When a user wants to submit an Image to the Image Gallery, the user will select “Content Type” from a drop down called “Post Type”.

    If the user selects “Image”, the form will only be populated with Metadata that relate only to Images. These are Category, Tags, Description and so on. Then the user clicks submit, and the Form is submitted.

    But if the user selects “Posts”–the form will be populated with fields related only to Posts. These are Post Title, Featured Image, Category, Tags, and a Text Area called “Post Content” –where the user can type in the Post, and then click Submit.

    And if the user selects “WooCommerce”–the form will be populated with fields like Product Image, Price,SKU” and so on.

    Then if the user selects “Portfolio”, the form will be populated with Metadata related only to Portfolio. The user fills in the details and then clicks submit.

    2.) The beautiful thing about it is that, the form will be just One Single Form.
    But it will have multiple power to be used to Post Images, Blog Posts, WooCommerce Products and Portfolio items from the frontend.

    The next amazing thing is that, the form accurately sends each post type to its required and designated place. It will send images to the Image Gallery, it will send Blog Posts to Blog Posts, WooCommerce products to WooCommerce products, and Portfolio items to Portfolio.

    How can this be achieved?

  • Unread

    Display custom category fields on woocommerce checkout

    Hi, how are you?

    Hope doing amazing.

    I have created 3 custom fields in global categories with ACF, and it works fine.

    But, is possible to display this custom category field values on woo-commerce checkout with ACF PRO?

    Please check the enclosed pic TAG-1.jpg, I need to display at checkout:

    For example:
    -ID Proyecto: 7011r000001unv0AAA
    -Códgio Empresa: 0014
    -Código Particular: 0015

    thanks!

  • Unread

    iframe error with woocommerce product editing page

    Hi,

    I have a weird situation on Woocommere product editing.

    I set up some fields (NO image fields) with ACF to aim on Woo, and it does work fine (Meaning all custom fields are displaying fine).

    Then, I tried to enter a new product for the first time (as a test). I tried to upload a media file for the product image. Well, it should or must show the uploading page with iframe, but it doesn’t…

    Uploading a image works fine and can edit all other data. Only problem is that uploading image page (or panel) does not display with iframe.

    With uploading Image gallery works fine = it DOES shows with iframe. It is so weird.

    To solve this, I have changed a theme, deactivate all plugins except for woo.

    WORKS: woocommerce only
    WORKS: woo and ACF but deactivate the field group.
    NOT WORK: woo and ACF + activate the field group.

    I must apologize if I am not explaining well, but I hope you understand what I tried to solve.

    Any advice or idea are appreciated.

  • Helping

    ACF + WPML: Translate fields but copy field status

    Hi ACF team

    Your plugin is doing a great job on our website. But there is one thing that I cannot get working.

    – I have some woocommerce products
    – I allready translated the products from Dutch to English
    – After that I added a couple of ACF fields to the product page. To be exactly: radio buttons. I added them at both languages and I translated them too.

    What do I want to achieve:
    The radio buttons are there so I can let the admin user select, when a product is out of stock, when the product is in stock again. So the admin user can select a month a month part and a year.
    I want to achieve that the admin user has to fill in the radio buttons at one language. So the other language will sync the radio button status.

    But that’s the problem.
    At the bottom of the admin product page I can change some WPML settings. For example the ACF field month I can select:
    – Don’t translate
    – Copy
    – Copy once
    – Translate

    When I choose translate, the translation is fine but the radio button status isn’t synced between both languages
    When I choose copy, the radio buttons are synced between both languages, but there is no translation

    Can you tell me how I can sync en translate at the same time? Is it even possible?

    I hope I hear you soon.

    Best regards,
    Mark

  • Unread

    Can I use ACF to update user's username, display name, or nickname?

    hi, I am wondering if it is possible to use ACF to update user’s username, display name, or nickname? My particular situation is to add ACF to the bottom of a Woocommerce checkout page.

    Thanks!

  • Unread

    multiple forms in front end user account

    Hi all.

    I’m building a website that is for booking events, the e-commerce platform is woocommerce. I’ve acted an action to add a new page to the user account called family, where I want the user to be able to manage their family members and contact info.

    So far I’ve added the page, created a repeater for user where they can add a family member and fill in that members information, it saves and all works great.

    Now I’d like to add an ACF group before the repeater that has main information such as emergency contact details and next of kin, but I can’t figure out how to display two fields (the group and the repeater) within the one action and only have one save button to save the details to the users account.

    This is what I have so far that works for the repeater, but if anyone could steer me in the right direction as to how to add the group field, it’d be hugely appreciated.

    <?php
      acf_form_head();
      get_header(); 
    ?>
    
    Family
    
    <div class="family-members-form"><?php 
    
     if ( !is_user_logged_in() ){ 
     echo 'You are not logged in. <br /> <a href="' . get_permalink(31) .'">Log In &rarr;</a>';
    
     } else {
    
     $user = wp_get_current_user();
     
    
    $options = array(
      // 'field_groups' => ['group_5cbd99ef0f584'],
      'fields' => ['field_5f24194f719ca'],
      'form_attributes' => array(
        'method' => 'POST',
        'action' => admin_url("admin-post.php"),
      ),
      'html_before_fields' => sprintf(
        '<input type="hidden" name="action" value="adaptiveweb_save_profile_form">
        <input type="hidden" name="user_id" value="user_%s">',
        $user->ID
      ),
      'post_id' => "user_{$user->ID}",
      'form' => true,
      'html_submit_button' => '<button type="submit" class="acf-button button button-primary button-large" value="Update Profile">Update Profile</button>',
    );
    
    acf_form($options);
     }
    
     ?>
     
     </div>

reply

  • I’m still looking for a solution. I’m starting to believe that no one using woocommerce is using that platform for selling car parts There’s simply no way to find a good solution to do proper filtering.

    I’m super desperate

  • Is there any update on this 6 months later? We have a number of ecommerce sites that use ACF fields for custom order data and we are basically back to inserting meta fields the old way, negating the value of ACF for Woocommerce sites.

    Compatibility mode, as I understand it, just negates all the benefits of the Woocommerce HPOS database optimization by constantly syncing the new system with the old system. Doesn’t seem to be a permanent fix.

  • This error started after we created a custom image field for categories in ACF and now when we try to create a new Archive template in Elemetor we get the following error:

      Uncaught Error: Object of class WP_Term could not be converted to string in /nas/content/live/stage/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:96
    Stack trace:
    #0 /nas/content/live/stage/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php(246): acf_get_value(Object(WP_Term), Array)
    #1 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/dynamic-value-provider.php(48): get_field_object('field_67a642620...', Object(WP_Term))
    #2 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/dynamic-value-provider.php(60): ElementorPro\Modules\DynamicTags\ACF\Dynamic_Value_Provider->get_field_object('field_67a642620...', Object(WP_Term))
    #3 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/dynamic-value-provider.php(22): ElementorPro\Modules\DynamicTags\ACF\Dynamic_Value_Provider->get_taxonomy_field_data('field_67a642620...', 'category_carous...')
    #4 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/module.php(170): ElementorPro\Modules\DynamicTags\ACF\Dynamic_Value_Provider->get_value('field_67a642620...')
    #5 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/tags/acf-image.php(40): ElementorPro\Modules\DynamicTags\ACF\Module::get_tag_value_field(Object(ElementorPro\Modules\DynamicTags\ACF\Tags\ACF_Image))
    #6 /nas/content/live/stage/wp-content/plugins/elementor/core/dynamic-tags/data-tag.php(44): ElementorPro\Modules\DynamicTags\ACF\Tags\ACF_Image->get_value(Array)
    #7 /nas/content/live/stage/wp-content/plugins/elementor/core/dynamic-tags/manager.php(207): Elementor\Core\DynamicTags\Data_Tag->get_content()
    #8 [internal function]: Elementor\Core\DynamicTags\Manager->get_tag_data_content('f61fc6a', 'acf-image', Array)
    #9 /nas/content/live/stage/wp-content/plugins/elementor/core/dynamic-tags/manager.php(100): call_user_func_array(Array, Array)
    #10 /nas/content/live/stage/wp-content/plugins/elementor/core/dynamic-tags/manager.php(61): Elementor\Core\DynamicTags\Manager->parse_tag_text('[elementor-tag ...', Array, Array)
    #11 /nas/content/live/stage/wp-content/plugins/elementor/includes/controls/base-data.php(91): Elementor\Core\DynamicTags\Manager->parse_tags_text('[elementor-tag ...', Array, Array)
    #12 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/controls-stack.php(1329): Elementor\Base_Data_Control->parse_tags('[elementor-tag ...', Array)
    #13 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/controls-stack.php(1176): Elementor\Controls_Stack->parse_dynamic_settings(Array)
    #14 /nas/content/live/stage/wp-content/plugins/elementor/core/files/css/post.php(315): Elementor\Controls_Stack->get_parsed_dynamic_settings()
    #15 /nas/content/live/stage/wp-content/plugins/elementor/core/files/css/post.php(297): Elementor\Core\Files\CSS\Post->render_element_styles(Object(Elementor\Widget_Image_Box))
    #16 /nas/content/live/stage/wp-content/plugins/elementor/core/dynamic-tags/dynamic-css.php(36): Elementor\Core\Files\CSS\Post->render_styles(Object(Elementor\Widget_Image_Box))
    #17 /nas/content/live/stage/wp-content/plugins/elementor/core/dynamic-tags/dynamic-css.php(40): Elementor\Core\DynamicTags\Dynamic_CSS->render_styles(Object(Elementor\Widget_Image_Box))
    #18 /nas/content/live/stage/wp-content/plugins/elementor/core/files/css/post.php(178): Elementor\Core\DynamicTags\Dynamic_CSS->render_styles(Object(Elementor\Includes\Elements\Container))
    #19 /nas/content/live/stage/wp-content/plugins/elementor/core/files/css/base.php(687): Elementor\Core\Files\CSS\Post->render_css()
    #20 /nas/content/live/stage/wp-content/plugins/elementor/core/files/base.php(155): Elementor\Core\Files\CSS\Base->parse_content()
    #21 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/loop-builder/files/css/loop-css-trait.php(161): Elementor\Core\Files\Base->get_content()
    #22 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/loop-builder/skins/skin-loop-taxonomy-base.php(97): ElementorPro\Modules\LoopBuilder\Skins\Skin_Loop_Taxonomy_Base->print_dynamic_css(51, 7304)
    #23 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/loop-builder/skins/skin-loop-taxonomy-base.php(75): ElementorPro\Modules\LoopBuilder\Skins\Skin_Loop_Taxonomy_Base->render_post()
    #24 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/loop-builder/skins/skin-loop-taxonomy-base.php(55): ElementorPro\Modules\LoopBuilder\Skins\Skin_Loop_Taxonomy_Base->render_loop_content(Array, 7304)
    #25 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/loop-builder/skins/skin-loop-taxonomy-base.php(40): ElementorPro\Modules\LoopBuilder\Skins\Skin_Loop_Taxonomy_Base->prepare_template_loop(Array, 7304)
    #26 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/woocommerce/skins/skin-loop-product-taxonomy.php(25): ElementorPro\Modules\LoopBuilder\Skins\Skin_Loop_Taxonomy_Base->render()
    #27 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/skin-base.php(79): ElementorPro\Modules\WooCommerce\Skins\Skin_Loop_Product_Taxonomy->render()
    #28 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/widget-base.php(634): Elementor\Skin_Base->render_by_mode()
    #29 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/widget-base.php(775): Elementor\Widget_Base->render_content()
    #30 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/element-base.php(483): Elementor\Widget_Base->print_content()
    #31 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/element-base.php(1442): Elementor\Element_Base->print_element()
    #32 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/element-base.php(483): Elementor\Element_Base->print_content()
    #33 /nas/content/live/stage/wp-content/plugins/elementor/core/base/document.php(1890): Elementor\Element_Base->print_element()
    #34 /nas/content/live/stage/wp-content/plugins/elementor/core/base/document.php(1806): Elementor\Core\Base\Document->do_print_elements(Array)
    #35 /nas/content/live/stage/wp-content/plugins/elementor/core/base/document.php(1204): Elementor\Core\Base\Document->print_elements(Array)
    #36 /nas/content/live/stage/wp-content/plugins/elementor/includes/frontend.php(1203): Elementor\Core\Base\Document->print_elements_with_wrapper(Array)
    #37 /nas/content/live/stage/wp-content/plugins/elementor/includes/frontend.php(1271): Elementor\Frontend->get_builder_content('7002', false)
    #38 /nas/content/live/stage/wp-content/plugins/elementor-pro/modules/library/wp-widgets/elementor-library.php(47): Elementor\Frontend->get_builder_content_for_display('7002')
    #39 /nas/content/live/stage/wp-includes/class-wp-widget.php(394): ElementorPro\Modules\Library\WP_Widgets\Elementor_Library->widget(Array, Array)
    #40 /nas/content/live/stage/wp-content/plugins/megamenu/classes/widget-manager.class.php(891): WP_Widget->display_callback(Array, Array)
    #41 /nas/content/live/stage/wp-content/plugins/megamenu/megamenu.php(641): Mega_Menu_Widget_Manager->show_widget('elementor-libra...')
    #42 /nas/content/live/stage/wp-includes/class-wp-hook.php(324): Mega_Menu->add_widgets_to_menu(Array, Object(stdClass))
    #43 /nas/content/live/stage/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
    #44 /nas/content/live/stage/wp-includes/nav-menu-template.php(234): apply_filters('wp_nav_menu_obj...', Array, Object(stdClass))
    #45 /nas/content/live/stage/wp-content/plugins/megamenu/classes/widgets/widget.class.php(55): wp_nav_menu(Object(stdClass))
    #46 /nas/content/live/stage/wp-content/plugins/elementor/includes/widgets/wordpress.php(284): Mega_Menu_Widget->widget(Array, Array)
    #47 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/controls-stack.php(2366): Elementor\Widget_WordPress->render()
    #48 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/widget-base.php(636): Elementor\Controls_Stack->render_by_mode()
    #49 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/widget-base.php(775): Elementor\Widget_Base->render_content()
    #50 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/element-base.php(483): Elementor\Widget_Base->print_content()
    #51 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/element-base.php(1442): Elementor\Element_Base->print_element()
    #52 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/element-base.php(483): Elementor\Element_Base->print_content()
    #53 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/element-base.php(1442): Elementor\Element_Base->print_element()
    #54 /nas/content/live/stage/wp-content/plugins/elementor/includes/base/element-base.php(483): Elementor\Element_Base->print_content()
    #55 /nas/content/live/stage/wp-content/plugins/elementor/core/base/document.php(1890): Elementor\Element_Base->print_element()
    #56 /nas/content/live/stage/wp-content/plugins/elementor/core/base/document.php(1806): Elementor\Core\Base\Document->do_print_elements(Array)
    #57 /nas/content/live/stage/wp-content/plugins/elementor/core/base/document.php(1204): Elementor\Core\Base\Document->print_elements(Array)
    #58 /nas/content/live/stage/wp-content/plugins/elementor/includes/frontend.php(1203): Elementor\Core\Base\Document->print_elements_with_wrapper(Array)
    #59 /nas/content/live/stage/wp-content/plugins/elementor/includes/frontend.php(1271): Elementor\Frontend->get_builder_content('890', false)
    #60 /nas/content/live/stage/wp-content/plugins/header-footer-elementor/inc/class-header-footer-elementor.php(638): Elementor\Frontend->get_builder_content_for_display('890')
    #61 /nas/content/live/stage/wp-content/plugins/header-footer-elementor/inc/hfe-functions.php(89): Header_Footer_Elementor::get_header_content()
    #62 /nas/content/live/stage/wp-includes/class-wp-hook.php(324): hfe_render_header('')
    #63 /nas/content/live/stage/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
    #64 /nas/content/live/stage/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #65 /nas/content/live/stage/wp-content/themes/astra/inc/core/theme-hooks.php(143): do_action('astra_header')
    #66 /nas/content/live/stage/wp-content/themes/astra/header.php(62): astra_header()
    #67 /nas/content/live/stage/wp-includes/template.php(810): require_once('/nas/content/li...')
    #68 /nas/content/live/stage/wp-includes/template.php(745): load_template('/nas/content/li...', true, Array)
    #69 /nas/content/live/stage/wp-includes/general-template.php(48): locate_template(Array, true, true, Array)
    #70 /nas/content/live/stage/wp-content/plugins/elementor/modules/page-templates/templates/header-footer.php(9): get_header()
    #71 /nas/content/live/stage/wp-includes/template-loader.php(106): include('/nas/content/li...')
    #72 /nas/content/live/stage/wp-blog-header.php(19): require_once('/nas/content/li...')
    #73 /nas/content/live/stage/index.php(17): require('/nas/content/li...')
    #74 {main}
      thrown
  • Official Response from ACF.

    As for custom fields on orders, with Woo’s introduction of HPOS, they’ve moved order data, and order metadata to dedicated tables. This means ACF isn’t able to read or write the data required for posts to work. They’ve also changed the internal post type for orders which breaks location rules. We’re currently assessing the best way to bring support for HPOS in Woo to ACF.

    For now, if you go to WooCommerce settings > Advanced > Features, you can enable compatibility mode and once it has synched your orders back to the legacy format, you can then toggle “WordPress posts storage” as the storage mode, which uses the legacy post names and tables to store your data which is compatible with ACF.

  • Are you adding this into the default woocommerce account dashboard?

    If so you might need ‘form’ => false

    So multiple forms are not rendered in the dom. ie;

    <form action="{default_wc_account_url}" method="POST">
      <form action="{ACF_FORM}"> // your form is creating this.
      </form> // and this inside the default form.
    </form>
  • Same problem here with ACF Pro.

    ACF custom fields are not showing in Woocommerce Orders, but they are working fine in other post types.

    I’m using last version: 6.3.5. I’ve tried in 6.1.8 and it’s working as expected.

    Thanks!

  • Hi Izabela,

    Here are a few steps to fix your ACF custom fields issue on products:

    Location Rules: Ensure the field group’s location rule is set to “Post Type” is equal to “Product”.
    Display Rules: Make sure there are no extra rules hiding the fields.
    Theme Compatibility: Try switching to a default theme to see if that helps.
    Plugin Conflicts: Deactivate other plugins to check for conflicts.
    Updates: Ensure ACF and WooCommerce are up-to-date.
    Screen Options: On the product edit page, check that custom fields are enabled in “Screen Options” at the top right.

  • I figured it out. If I do not check the checkbox for Advanced Custom Fields under the option “Update existing WooCommerce products with the data in this import file” it works as expected.

  • I would probably not try to do this with ACF. There are a lot of wholesale plugins for WooCommerce available that lets you do these things, like bulk discounts. I’d look there first.

    After you got that working you can figure out how to make it as easy as possible to change the daily prices. There are plugins for bulk editing, where you can manage the prices for several products in one screen.

    I would not make the fish a variable product, instead make a separate product for each fish type.

    Hope that helps.

  • Hi Carlxxon,

    I am not sure if my first try to reply got through, since I had this ‘you are not allowed to do this’ message popping up. So I’ll try a second time – hope you don’t mind.

    I am currently trying something similar – ideally ask for payment through WooCOmmerce – but haven’t found an appropriate solution yet. So I was wondering if you found a solution in the meantime?

    Thank you!
    Cheers
    t

    PS: So far i had a closer look at “User Submitted Posts Payments add-on” as it is described over here: https://creativeminds.helpscoutdocs.com/article/2804-cm-user-submitted-posts-use-case-how-to-let-your-users-submit-posts-without-accessing-the-site-backend-and-charge-the-money-for-posting

  • To display your custom field in the email template next to the quantity, you can modify the code to hook into the appropriate filter for the email template. Here’s an adjusted version of your code:
    `function email_custom_field($item_quantity, $cart_item, $cart_item_key, $order){
    $price = get_field(‘price_for’, $cart_item[‘product_id’]);
    return ($price) ?
    $item_quantity . ‘ / ‘ . $price
    :
    $item_quantity;
    }
    add_filter(‘woocommerce_order_item_quantity_html’, ’email_custom_field’, 999, 4);

    This code will display your custom field next to the quantity in DGCustomerFirst the email template. Ensure to place this code in your theme’s functions.php file or in a custom plugin.

  • add to functions.php , I managed to achieve fields from ACF in the response

    add_filter('woocommerce_rest_prepare_product_object', 'include_acf_fields_in_api_response', 10, 3);
    
    function include_acf_fields_in_api_response($response, $post, $request) {
        $data = $response->get_data();
    	$acf_fields = get_fields($response->data['id']);
        $data['acf'] = $acf_fields;
        $response->set_data($data);
        return $response;
    }
  • This is a question for people over at WooCommerce.

  • 
    // products_id = "621757000000383001";
    product = zoho.crm.getRecordById("Products",products_id);
    productData = Map();
    productData.put("name",product.get("Product_Name"));
    productData.put("regular_price",product.get("Unit_Price"));
    woocommerceProductId = product.get("Woocommerce_Product_ID");
    if(woocommerceProductId != null)
    {
    	response = invokeurl
    	[
    		url :"https://mywoocommercetozoho.asteamwork.com/wp-json/wc/v3/products/" + woocommerceProductId
    		type :Put
    		parameters:productData
    		connection:"as"
    	];
    	info response;
    	if(response.get("id") != null)
    	{
    		woocommercedata = Map();
    		woocommercedata.put("Woocommerce_Product_ID",response.get("id"));
    		update = zoho.crm.updateRecord("Products",products_id,woocommercedata);
    		info update;
    		meta_data = response.get("meta_data");
    		if(meta_data == null)
    		{
    			meta_data = List();
    		}
    		// Check if "zoho_product_id" key exists in meta_data
    		zoho_product_id_exists = false;
    		for each  meta in meta_data
    		{
    			if(meta.get("key") == "zoho_product_id")
    			{
    				meta.put("value",toString(products_id));
    				zoho_product_id_exists = true;
    			}
    		}
    		// If "zoho_product_id" key doesn't exist, add it to meta_data
    		if(!zoho_product_id_exists)
    		{
    			new_meta = Map();
    			new_meta.put("key","zoho_product_id");
    			new_meta.put("value",toString(products_id));
    			meta_data.add(new_meta);
    		}
    		productData1 = Map();
    		productData1.put("meta_data",meta_data);
    		sample_file = invokeurl
    		[
    			url :"https://mywoocommercetozoho.asteamwork.com/wp-json/wc/v3/products/" + response.get("id")
    			type :PUT
    			parameters:productData1.toString()
    			connection:"as"
    			content-type:"application/json"
    		];
    		info "Sample file:" + sample_file;
    	}
    	else
    	{
    		info "WooCommerce product update failed.";
    	}
    }
    else
    {
    	response = invokeurl
    	[
    		url :"https://mywoocommercetozoho.asteamwork.com/wp-json/wc/v3/products"
    		type :Post
    		parameters:productData
    		connection:"as"
    	];
    	info response;
    	if(response.get("id") != null)
    	{
    		woocommercedata = Map();
    		woocommercedata.put("Woocommerce_Product_ID",response.get("id"));
    		update = zoho.crm.updateRecord("Products",products_id,woocommercedata);
    		info update;
    		meta_data = response.get("meta_data");
    		if(meta_data == null)
    		{
    			meta_data = List();
    		}
    		// Check if "zoho_product_id" key exists in meta_data
    		zoho_product_id_exists = false;
    		for each  meta in meta_data
    		{
    			if(meta.get("key") == "zoho_product_id")
    			{
    				meta.put("value",toString(products_id));
    				zoho_product_id_exists = true;
    			}
    		}
    		// If "zoho_product_id" key doesn't exist, add it to meta_data
    		if(!zoho_product_id_exists)
    		{
    			new_meta = Map();
    			new_meta.put("key","zoho_product_id");
    			new_meta.put("value",toString(products_id));
    			meta_data.add(new_meta);
    		}
    		productData1 = Map();
    		productData1.put("meta_data",meta_data);
    		sample_file = invokeurl
    		[
    			url :"https://mywoocommercetozoho.asteamwork.com/wp-json/wc/v3/products/" + response.get("id")
    			type :PUT
    			parameters:productData1.toString()
    			connection:"as"
    			content-type:"application/json"
    		];
    		info "Sample file:" + sample_file;
    	}
    	else
    	{
    		info "WooCommerce product creation failed.";
    	}
    }
    
  • Looking at this example https://cfxdesign.com/create-a-custom-woocommerce-product-loop-the-right-way/

    The function wc_get_products() returns an object and the products are located in a the “products” property of that object. See the loop in the example were they reference $featured_products->products. I don’t know if this is right or not, you need to look into the WC documentation. I’m guessing that it’s not working correctly because you may not be looping correctly but that is just a guess. I’m not an expert on WC.

  • Struggling with WooCommerce product filtering using taxonomies (“Model” and “Model Year”). The system fails to distinguish between models and assumes incorrect associations with model years.

    Solutions:
    Hierarchical Taxonomies:

    Make “Model” taxonomy hierarchical.
    Custom Taxonomy Structure:

    Combine “Model” and “Model Year” into a single custom taxonomy.
    ACF Relationship Field:

    Use ACF Relationship field for flexible relationships.
    Custom Meta Fields:

    Implement custom meta fields for precise data control.
    Custom Search Filters:

    Build custom search queries considering both taxonomies.
    Custom Code for Plugin:

    Customize the Search & Filter plugin for specific taxonomy handling.
    Developer Assistance:

    Seek help from a developer for complex customizations.

  • I eventually solved the problem by switching hooks to woocommerce_checkout_update_order_meta
    So that it saves on order creation and not on order status processing, because it works and it also is fine for the particular usecase.

    I assume on this webhook the saving of the ACF field is only running once so the issue brought up by John doesn’t happen.

    Thank you John for your feedback and knowledge as it was invaluable for me to learn more about how ACF works! some of this stuff would have been a headache to figure out on my own.

    
    add_action( 'woocommerce_checkout_update_order_meta', 'update_product_custom_field_', 10, 1 );
    function update_product_custom_field_( $order_id ) {
        // Generate the shipping number using the order ID
        $shipping_number = 'SHIPPINGNUMBERTEST';
    
        // Update the custom field for the shipping number
        if (function_exists('update_field')) {
            update_field( 'order_shipping_number', $shipping_number, $order_id );
        }
    }
Viewing 25 results - 326 through 350 (of 889 total)