Support

Account

Home Forums Search Search Results for 'woocommerce'

Search Results for 'woocommerce'

topic

  • Helping

    Mapping user to post type

    Hello everyone!

    I am trying to build a social market place where each user has their own profile page. i would like users to be able to post products on their own page (im using woocommerce for that and its working fine for now) but also

      i want users to be able to visit each other’s pages and view each others products

    .

    Now thats were i am lost (i am not a developer but im trying my best to work with code and web dev concepts). At first I created a custom post type, added custom fields using ACF, and through using elementor theme builder, i created a loop to list all the members and singles to act as profile pages. however since i created post types not users i couldn’t set the login up. (how can a post type log in?)

    to fix this i created user login and registration, however i was not able to map the user to the respective post. Any ideas on how to solve this? perhaps even a completely different approach?

  • Unread

    Fields only showing up for 1 user

    I’ve created 3 field groups that are supposed to show up on woocommerce order editors. All of them are active on the ‘screen options’ tab and are showing for my user. When logging in via another user, all of the field groups are also active on the screen options tab and only one out of all 3 field groups show up.

    What I’ve tried to solve this issue:
    1. creating new user
    2. cleared cache
    3. activating & reactivating plugins

    None of which worked. It only ever shows up in my user. I’ve searched for this topic on ACF forums (the most relevant of which is this one), but no answer seems to solve things for me.

    Here are a few screenshots for your reference
    https://imgur.com/a/FCW0HcX

  • Solved

    Update a field when duplicating a post

    Hello,

    I’m using Woocommerce to duplicate Products and duplicating will be the preferred way for the user to create new products, since many custom fields will likely have the same values as existing products.

    Additionally, I have a field group called Product Readiness with a single required True/False field whose label asks “Are you ready to publish?”. This field group is set to display on Product Pages that don’t have a Post Status of Published. So the goal here, when a product is duplicated, is to encourage the user to make sure they’ve made all changes necessary before publishing.

    I just added this field/group after creating a few products. So if I duplicate one of them, the default value is no, and you have to switch to yes (as desired) to publish the post. However, if I duplicate a product that was originally a duplicate itself, then the value is set to yes, because the value was stored when the first duplicate was published.

    So I’m thinking that I need to update the field’s value to reset it to the default using update_field() when the product is duplicated. But I’m not really sure how to check for when a product is being duplicated. Can anyone demonstrate how I would add this functionality to my child theme’s functions file?

    Thank you!

  • Helping

    Bug with hasDatepicker

    Hello,

    ACF plugin conflicts with another plugin (RnB – WooCommerce Booking & Rental Plugin). I can’t use RnB’s calendar because ACF is adding its own on top of it with the hasDatepicker class. Would you have a solution to turn off ACF’s schedule so that I can use RnB’s schedule?

    Thank you !

  • Helping

    WooCommerce widget with ACF included

    I have created a taxonomy for Woo product attributed (colour).

    On the achieve page, I’ve added a widget to filter by colour.

    I want to adjust the filter to include the ACF field colour as well. But, so far I’ve been unable to find a solution.

    Can anyone assist, please?

  • Unread

    Create function in functions.php that displays ACF value for products post type.

    Hello, Dear Developers, Can you help?

    Can you help with next thing:
    1 – I wanna make function with ACF display function in functions.php for woocommerce
    2 – Wanna use next construction
    function {} // displaying custom field value for product post type
    add_action() // hook that i will use to add this value to archive or single product.

    ===

    in my case i really wanna make display function for ACF in functions.php for products.
    because i wanna make custom item products in archive too, and it’s really difficult add these values on specific pages. please help!!!

  • Helping

    Pre-fill form fields from WooCommerce order

    Hi all,

    We wanted to pre-fill some ACF form fields like company name, street name, number, post code etc. with data from the WooCommerce checkout.

    The use case is this: the company goes through the WooCommerce checkout to purchase a subscription first. The customer goes to Paypal to login and confirm the purchase and is being sent back to the WooCommerce checkout afterwards.

    Thus we know the company name and its billing address already. At this point, it’s being saved to both the database and stored in the session cookie (correct me if I’m wrong).

    Now the question: how do we obtain the available information and have it pre-filled it into a specific ACF form field (e.g. field_5fec83db09401)?

    The goal is to save the customer from typing in a giving information twice and therefore raise the overall usability of the site.

    I’d highly appreciate if you could point me into the right direction. After two hours of research, I still haven’t found what I look for (like pre-filling form fields from a WooCommerce order).

    Thank you,

    — Markus Seyfferth

  • Unread

    Repeater field on Woocommerce checkout page

    Hi,

    I am currently re-building an existing webshop for future updating purposes.

    The original webshop uses ACF repeating sections to add participants on the checkout page. Visitors can add the credentials of one or more children to participate.
    You can review this functionality here: https://ubuntu-sport.com/checkout/?add-to-cart=17502 (scroll down a bit)

    Now I am recreating this. I have a sample repeater field setup and added it to the checkout page with ‘acf_form’ https://www.advancedcustomfields.com/resources/acf_form/

    I can’t seem to get the repeater field working. It links to nowere.
    Check it out here: https://dev.bytris.nl/ubuntu/?page_id=8/?add-to-cart=13

    Anyone here to help?

  • Solving

    ACF & Woocommerce query

    Hi … needed some advice about adding custom fields to Woocommerce products cpt.

    Basically i have a woocommerce installation and i want to add a few more custom fields for each product. This i have done using ACF in WP admin to create a field group and attach it to the “products” cpt. So if i add a new product or edit existing product, i can see these fields and add data using them for that particular product in the wp backend.

    However, I have developed a front-end form using “gravity forms” which can add new products to the site from the user’s account (front-end) page. This works well using “gravity forms” and the “advanced post creation” plugin. However im not sure how to map the “custom fields” i created with ACF for the product. Does ACF store custom fields in the wp_posts_meta table as key, values for a CPT – products?

    Also a general question: How does ACF store custom field data in the DB for a post, page or custom post type? Tried searching the docs for info on this but couldnt find it or i may have missed it.

    Appreciate some thoughts on this.

    Thanks in advance.

  • Solving

    Cannot update field programmatically

    Hello,
    I am struggling with setting up True/False field value.

    I have simple function that should set field “objednavka_upravena” to true and set checked status in admin when order status changes:

    function eda_zmena_stavu_objednavky( $order_id, $old_status, $new_status,$order ){
    update_field(‘objednavka_upravena’, 1,$order_id);
    }

    add_action( ‘woocommerce_order_status_changed’, ‘eda_zmena_stavu_objednavky’, 99, 4 );

    However, the field not updated.

    Can you help please?

    Thanks for any suggestions.

  • Helping

    Add required checkbox on checkout page…

    Hello,
    I want to know if I can and how to create and add custom required checkbox on my order checkout page? I have install the plugin but in the “Location” – Show this field group if: “Checkout” is equal to “Review order before submit”.
    Please check the following link: https://growfox.co.uk/blog/add-custom-checkbox-woocommerce-checkout-page-free

    Thank you in advnace!

  • Unread

    Duplicate forms: Handling submission

    Hello everyone!

    I’m trying to create sort of “links” between WooCommerce order items and a custom field group at checkout time. The idea is to assign a field group “Entity” to a specific item in the order, so we can individualize the checkout process.

    I already went ahead and created the groups and forms for the Entity, it contains a name, birthdate and address. I also managed to render the form next to each product item, by iterating over the cart and calling the form via acfe_form(...).

    My issue is that I am unsure of how to access the individual forms upon submission. As far as I can see, fields are submit by their name property (or the key?), and there’s no way to customize how the POST body will look. This would not be an issue for single cart items, since then there would be no key duplicates, but if a form is rendered for every cart item then there will be duplicate names on the HTML input elements, which I’m pretty sure is not allowed.

    Previously we were using a repeater with the fields for the Entity mentioned above, but that didn’t really allow to visually link a product preview to each item in the repeater for the user. The goal is to show each Entity form input in a seperate table cell, inside the larger table representing the cart.

    Something that I attempted was to modify the name of the form field using the load_field filter. The idea was to postfix each field with the index of the item in the cart, so the input fields can be differentiated at submission time. It would not matter that this “breaks” the intended workflow, since the values can be handled by us inside the submission callback.

    function postfix_product_index ( $field ) {
    global $checkout_product_index;
    if ( $checkout_product_index != NULL ) {
    $field[‘name’] .= ‘_’ . $checkout_product_index;
    }
    return $field;
    }

    However, it does not seem like you can modify the name property like this.

    I’d be glad to give more input on this if I left something unclear.

  • Unread

    ACF and Woocommerce

    Hi
    Just need some help to see if something like this is possible somehow

    I need to use the sum of the quantity of all cart items to create a button or page link. So if cart quantity sum was 1 then this would conditionally display a button that I could add a custom link to. Similarly, if the quantity sum was 2. 3 or 4plus then a button for each of these would conditionally show. The purpose is to avoid having to display all four buttons and so only display the relevant button determined by the cart quantity sum. I thought that if an ACF field could automatically display the sum of the quantity of all cart items then I could use some logic to do the rest.

    Hope this makes sense 🙂

  • Solving

    Woo Commerce Banner Image

    Please Help, I’ve created an archive-product.php and in it I have my,
    <?php woocommerce_content();?>

    In the global-top-banner above this, I have my usual php code to call in my theme banner image (using my usual ACF image ID). Works perfectly on all other, page.php, single.php, category.php, etc…

    The button to add the picture is showing on the backend on the Store page as its seeing my ACF rule to add to all default pages, and I can obviously select the image I’d like to choose from the media library here.

    However I can not find any ACF selector to display the image on this Store page??

    I’ve tried trying to add a;

    Template Name: Woo Page – but that doesn’t work – as it doesn’t appear on the Store (backend) to select.

    I’ve read that… even though this Store appears as a page it gets converted to a ‘Special Archive’ but I can’t tap into this using Taxonomy = Category or Taxonomy = Prod_Category…

    How do I get this image to show on this page please…

    (archive-product.php code below)

    <!– Main –>
    <main>

    <!– Top Banner –>
    <div class=”thin-top-banner”>
    <?php get_template_part(‘top-banners/global’,’top-banner’);?>
    </div>

    <!– Section One | Centered Content –>
    <section class=”centered-content”>
    <div class=”woo-content-container”>
    <?php woocommerce_content();?>
    </div>
    </section>

    </main>

  • Helping

    Auto populate woocommerce product attribute

    Hello,

    I have a repeater field assigned to product CPT : date & hour
    Is there a way to auto-populate the product attribute field with the repeater row values? (juste the date)

    example: for one product I have 2 dates : 20th decembre 2020 and 22th january 2021
    I would like to have the product attribute automatically set as :
    20th decembre 2020 | 22th january 2021 (screenshot attached)

    product attribute

  • Solved

    Price field as WooCommerce price

    I’ve seen online that you can add all Custom Post Types to a WooCommerce cart as long as the CPT has a price field. The only issue is that you have to tell WooCommerce what CPT field contains the price.

    Afterwords you can create an add-to-cart url like this:
    https://yourdomain.com/?add-to-cart=XXX (XXX being the Custom Post Type post ID)

    Why is this handy?
    I have an online menu (just to inform guest what we order) but because of Corona we have to close our doors so I want these dishes to be ordered online.

    The code should be something like this but the CPT is not added to cart:

    
    add_filter('woocommerce_get_price', 'yl_get_dish_price', 20,2);
    function yl_get_dish_price($price,$post) {
    	if ($post->post->post_type === 'dish') {
    		$price = get_field('price', $post->ID);
    	}
    	return $price;
    }
    
  • Helping

    Display contact form 7 shortcode in front end

    HI sorry for the bad English…

    I would like to display the contact form 7 shortcode dynamic on the theme. I already add a Textarea in woocommerce Here my code:

    $enquiry_form_settings[] = array ( 
          'id'   => 'we_enquiry_form_textarea',
          'name' => __( 'Add Contact Form 7 Shortcodes', 'we-extra-extension' ),
          'type' => 'textarea',
          'css'  => 'min-height:200px',
          'placeholder' => 'Add Contact Form 7 Enquiry Form Shortcodes',
          'label' => __('Custom Contact Form 7 Shortcode', 'extra-extension')
    
        );

    Textarea working perfectly But I am facing a problem to display contact form 7 shortcode, please someone helps me

    Here display code :

    function demo_text () {
    
    if ( get_option ('enquiry_form_textarea') && get_option ( 'enquiry_form_textarea')){
             
        echo do_shortcode( ['cform_shortcode']);  
    
       }
    }
    add_action( 'woocommerce_after_add_to_cart_button', 'demo_text' );

    Thanks all

  • Helping

    ACF & WooCommerce possible conflict when using page rule (shop)

    I have created a slider hero for the woocommerce.php template as well as repeater field with ACF that allows a user to insert additional slides to the slider with a rule that will only display the hero on the shop page.

    I have then created a template part that displays the hero so I don’t clogging up the woocommerce.php template with extra code.

    At that stage I had not yet added any products to my store and the hero is displaying and working as expected with the WooCommerce notice saying there is no products in the store, great, or so I thought.

    After completing the hero, I went ahead and added my first product to the store and guess what, the hero has completely disappeared. Now I’m left wondering how can I fix this? I have removed all of the CPT scripting and just echoed out a test message to see if the template is loading correctly and as expected it is, I see the test message echoed to the top of the store, where the hero should be.

    I’ve been at trying to get this working for an hour now and I can’t seem to come across anything that stands out to me. I have included the hero template part as well as the woocommerce.php template.

    woocommerce.php

    <?php
    /**
     * The template for displaying WooCommerce
     * 
     * @package StuCowley
     * @subpackage bellezashop
     * @since 1.0.0
     */
    
    get_header();
    
    get_template_part( 'template-parts/hero/shop-hero' );
    ?>
    
    <div class="sc-page-content">
      <?php woocommerce_content(); ?>
    </div><!-- /.sc-page-content -->
    
    <?php
    get_footer();

    shop-hero.php

    <?php
    /**
     * Template part for displaying the frontpage hero.
     * 
     * @package StuCowley
     * @subpackage bellezashop
     * @since 1.0.0
     */
    
    if ( have_rows( 'hero_slide' ) ) :
      while ( have_rows( 'hero_slide' ) ) : the_row();
        
        $headlineHeading = get_sub_field( 'headline_heading' );
        $headlineParagraph = get_sub_field( 'headline_paragraph' );
        
        $primaryBtnTitle = get_sub_field( 'primary_button_title' );
        $primaryBtnLink = get_sub_field( 'primary_button_link' );
    
        $secondaryBtnTitle = get_sub_field( 'secondary_button_title' );
        $secondaryBtnLink = get_sub_field( 'secondary_button_link' );
        
        $bgImg = get_sub_field( 'background_image' );
        $bgImgOverlay = get_sub_field( 'background_overlay' );
        $bgColour = get_sub_field( 'background_colour' );
        $bgTextColour = get_sub_field( 'background_text_colour' );
    
        // If the hero has a background image, echo the image
        if ( $bgImg ) {
    ?>
    
    <div id="shop-hero-slider">
      <section class="sc-hero-feature" style="background-image: url('<?php echo $bgImg; ?>'); background-color: <?php echo $bgImgOverlay; ?>; color: <?php echo $bgTextColour; ?> !important;">
    
      <?php 
      // Else if there is no background image applied, use the set background colour
      } elseif( $bgColour ) { 
      ?>
    
      <section class="sc-hero-feature" style="background-color: <?php echo $bgColour; ?>">
    
      <?php } ?>
        <div class="carousel-cell">
          <div class="sc-hero-feature-container">
            <h2 style="color: <?php echo $bgTextColour; ?>">
              <?php echo $headlineHeading; ?>
            </h2>
    
            <p style="color: <?php echo $bgTextColour; ?>">
              <?php echo $headlineParagraph; ?>
            </p>
    
            <?php if ( $primaryBtnTitle ) { ?>
            <div class="sc-hero-feature-btn-group">
              <div>
                <a href="<?php echo $primaryBtnLink; ?>" class="sc-hero-feature-btn sc-hero-feature-btn-primary">
                  <?php echo $primaryBtnTitle; ?>
                </a>
              </div>
            <?php } ?>
    
            <?php if ( $secondaryBtnTitle )  { ?>
              <span></span>
    
              <div>
                <a href="<?php echo $secondaryBtnLink ?>" class="sc-hero-feature-btn sc-hero-feature-btn-secondary">
                  <?php echo $secondaryBtnTitle ?>
                </a>
              </div>
            </div><!-- /.sc-hero-feature-btn-group -->
            <?php } ?>
          </div><!-- /.sc-hero-feature-container -->
        </div><!-- /.carousel-cell -->
      </section><!-- /.sc-hero-feature -->
    
      <?php
      endwhile;
      endif;
      
      wp_reset_postdata();
      ?>
    </div><!-- /#shop-hero-slider -->

    I’ve been backwards and forwards, re-typing checking for typos and I have come up empty. Is this feature even possible or is WooCommerce and ACF not going to play nice on this?

  • Helping

    Post CSS names

    Is there any way when creating a page link or post object to include the posts CSS selectors? For example, a WooCommerce link may contain all of this information in the CSS:

    <li class="wcpa_has_options product type-product post-8191 status-publish instock product_cat-slices product_tag-dairy-free product_tag-vegan product_tag-vegetarian has-post-thumbnail shipping-taxable purchasable product-type-simple"><a href="">Product name</a></li>

    So that’s what I’d like to include automatically when creating a link from ACF.

    Hope that makes sense!

  • Solving

    The original WordPress 'Custom fields' tab

    I want to change some custom WooCommerce checkout fields (created by a checkout plugin) and these are stored as original WordPress custom fields.

    But because I have installed the ACF plugin the original Custom Fields tab is gone.

    I tried to add this to my function.php without any result:

    add_filter('acf/settings/remove_wp_meta_box', '__return_false');

    What can I do to get the original WordPress ‘Custom fields’ tab back?

  • Helping

    Add multiple products programmatically in WooCommerce from ACF repeater

    I am adding products programatically in WooCommerce and I am trying to add multiple free products to an order. The Free products are selected in the theme settings via an Advanced Custom Fields repeater. This repeater has no limit, so can be several products.

    I have managed to to get one product to show (the latest created in the repeater) with a price of 0. How Do I create so if I have more then one product selected the order gets updated with all of these as separate line items? I assume a foreach loop somehow?

    Current relevant code:

    
        $current_date = strtotime(date('Y-m-d H:i:s'));
        $categories   = get_field('free_product_category', 'option');
    
        if(have_rows('theme_free_products', 'options')){
            while(have_rows('theme_free_products', 'options')){
                the_row();
                $start_date = get_sub_field('start_date');
                $end_date = get_sub_field('end_date');
                if(strtotime($start_date) <= $current_date && strtotime($end_date) > $current_date){
                    $product_id = get_sub_field('product', false);
                }
            }
        }
    
        $new_product_price = 0;
        $productextra    = wc_get_product( $product_id );
        $productextra->set_price( $new_product_price );
        $item_id    = $order->add_product( $productextra, 1 );
  • Helping

    Submit ACF frontend form with WooCommerce

    I finally managed to display my ACF Fields on the front-end using the acf_form().

    I Specifically displayed them in the CHECKOUT page of WooCommerce so that the buyer has to enter some information first then PAY.

    I hope by now you get the picture. I sell Design Services so when a client chooses a Package. they are then redirected to the CHECKOUT Page where they have to enter their billing details PLUS the CUSTOM FIELDS THAT I CREATED AND DISPLAYED USING THE acf_form(). here’s the code:

    
    <?php acf_form_head(); ?>
    
    <?php
    
         acf_form(array(
             'form' => false,
             'post_id'      => 'new_post',
             'post_title'   => false,
             'post_content' => false,
             'new_post'     => array(
                 'post_type'    => 'create_project',
                 'post_status'  => 'publish'
             ),
         ));
    
    ?>
    

    So as you can see, I disabled the Submit button because I want the Post (Design Project in my case) to be published ONLY AFTER the client pays.

    So I have to somehow link the Submit property to the WooCommerce Pay Button.

    I hope I was clear enough and please assist me through this

  • Helping

    Display ACF Field Globally Below Product Title #WooCommerce

    Hi,

    I’ve created a ACF field which I want to display just below the product title globally.

    The route I have taken is basically editing the single product page file, cart file, checkout file, etc to display the ACF field. But this involves adding & maintaining code in multiple files.

    Is there a way I can globally attach the ACF field to appear just below the Product title? So that It appears automatically everywhere inside woocommerce including emails, searches, cart, checkout etc?

    Thank you!

  • Solving

    Setting Woocommerce ACF order field

    I’m trying to populate an order field with options set on our checkout form.

    function custom_field_value( $checkout ) {
        $field_key = "field_xxxxxxxxxxxxx"; 
        $field = get_field_object($field_key);
        if( $field ) {
            echo '<div id="custom_field_value">';
            woocommerce_form_field( 'custom_field_value', array(
                'type'          => 'select',
                'class'         => array('custom_field_value form-row-wide'),
                'label'         => __('Descriptive Name'),
                'required'    => true,
                'options'     => $field['choices']
            ), $checkout->get_value('custom_field_value'));
            echo '</div>';
        }
    }
    add_action( 'woocommerce_after_checkout_billing_form', 'custom_field_value' );
    add_action( 'woocommerce_checkout_update_order_meta', 'populate_custom_field_value' );
    
    function populate_custom_field_value( $order_id ) {
    	if ( ! empty( $_POST['custom_field_value'] ) ) {
    		update_field( 'field_xxxxxxxxxxxxx', sanitize_text_field( $_POST['custom_field_value'], $order_id ));
    	}
    }

    But even though my selector is inserted correctly, it’s not setting the field on the order.
    Can anyone see what I’m missing here?

  • Solving

    Nested Relationships

    I have two categories of WooCommerce products: Enclosures and Cameras

    Each Enclosure entry has a relationship field product_cameras, where multiple compatible cameras are selected.

    Each Camera entry has a relationship field product_manufacturer, where a single manufacturer (post) is selected.

    My code will pull all the correct camera information, however, I can’t get it to pull any of the information for the manufacturer (it is displaying the title for the enclosure post instead).

    Any help is greatly appreciated!

    <?php
    $featured_posts = get_field('product_cameras');
    if( $featured_posts ): ?>
    <div class="row justify-content-left">
            <?php foreach( $featured_posts as $featured_post ): 
            $title = get_the_title( $featured_post->ID );
            $image = get_the_post_thumbnail_url( $featured_post->ID, 'thumbnail' );
            $pdf = get_field( 'product_spec_sheet', $featured_post->ID );
            $manufacturer = get_field( 'product_manufacturer', $featured_post->ID );
            $logo = get_field( 'manufacturer_logo-darkbg', $manufacturer );
            $manuname = get_the_title( $manufacturer );
            ?>
                <div class="col col-sm-3 pb-5"> 
                   <div class="card h-100 product-card product-card--camera clear-styles">
                        
    <div class="card-body product-card--image">
                     	<img src="<?php echo esc_html( $image ); ?>" class="pb-4">
    
     <img src="<?php echo esc_url( $logo['url'] ); ?>" style="max-height:25px;">
    <p><?php echo esc_html( $manuname ); ?> <?php echo esc_html( $title ); ?> 
    <?php if( $pdf ): ?>
    	  <a href="<?php echo get_site_url(); ?><?php echo esc_html( $pdf ); ?>" target="_blank"><i class="fas fa-info-circle"></i></a>
    <?php endif; ?>
    </p>
    </div>
                   </div>
                </div>
            <?php endforeach;  ?>
    </div>
    <?php endif; ?>
Viewing 25 results - 276 through 300 (of 889 total)