Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter wideeyed

    (@wideeyed)

    I don’t see that on my end. I’m using the popup, so “Enquiry Popup Backdrop Disable” and “Enquiry Popup Disable” are both unchecked.

    Thread Starter wideeyed

    (@wideeyed)

    Got it! Here’s the code @damiansmith86.

    add_action( 'init', 'move_enquiry_button');
    
    function move_enquiry_button() {
      global $WC_Woocommerce_Catalog_Enquiry;
      $settings = $WC_Woocommerce_Catalog_Enquiry->options;
    
      remove_action('woocommerce_single_product_summary', array($WC_Woocommerce_Catalog_Enquiry->frontend, 'add_form_for_enquiry_without_popup'), 100);
      remove_action('woocommerce_single_product_summary', array($WC_Woocommerce_Catalog_Enquiry->frontend, 'add_form_for_enquiry'), 100);
    
      if (isset($settings['is_disable_popup']) && $settings['is_disable_popup'] == "Enable") {
        add_action('woocommerce_single_product_summary', array($WC_Woocommerce_Catalog_Enquiry->frontend, 'add_form_for_enquiry_without_popup'), 15);
      } else {
        add_action('woocommerce_single_product_summary', array($WC_Woocommerce_Catalog_Enquiry->frontend, 'add_form_for_enquiry_without_popup'), 15);
      }
    }

    Thanks @dualcube!

    • This reply was modified 6 years, 9 months ago by wideeyed.
    Thread Starter wideeyed

    (@wideeyed)

    Lol. I wish I was a real dev, but I’m getting closer! So @dualcube, I was able to unhook the button and get it where I wanted by placing it into the init hook as you suggested. The problem now is that I end up with both the popup and non-popup buttons. ??

    add_action( 'init', 'test_init');
    
    function test_init() {
       global $WC_Woocommerce_Catalog_Enquiry;
       remove_action('woocommerce_single_product_summary', array($WC_Woocommerce_Catalog_Enquiry->frontend, 'add_form_for_enquiry_without_popup'), 100);
       remove_action('woocommerce_single_product_summary', array($WC_Woocommerce_Catalog_Enquiry->frontend, 'add_form_for_enquiry'), 100);
     
       add_action('woocommerce_single_product_summary', array($WC_Woocommerce_Catalog_Enquiry->frontend, 'add_form_for_enquiry_without_popup'), 15);
       add_action('woocommerce_single_product_summary', array($WC_Woocommerce_Catalog_Enquiry->frontend, 'add_form_for_enquiry'), 15);
    }

    For the moment I’m just adding the popup inquiry form. I believe the answer for the doubled button is somewhere in lines 186-190 of class-wc-Woocommerce-Catalog-Enquiry-frontend.php

    if (isset($settings['is_disable_popup']) && $settings['is_disable_popup'] == "Enable")
       add_action('woocommerce_single_product_summary', array($this, 'add_form_for_enquiry_without_popup'), 100); 
    } else {
       add_action('woocommerce_single_product_summary', array($this, 'add_form_for_enquiry'), 100); 
    }
    • This reply was modified 6 years, 9 months ago by wideeyed. Reason: Cleaning up formatting
    Thread Starter wideeyed

    (@wideeyed)

    Thanks @dualcube. Dumb question, would I need to add the two functions from the plugin to my function.php? So, copy the plugins code into my function.php to call with the add_action?

    Caleb, neither of those methods worked for me.

    I uploaded the image to the media library and grabbed it’s id from the URL in the Attachment Details. I then used the id of the product category, again from the URL.

    This was my command:

    wp wc product_cat update 134 --image="{id: 9975'}" --user=1

    And WP CLI reported: Success: Updated product_cat 134.

    When I refresh the product categories page, or edit that category, the new image isn’t there.

    I’ve also got to agree with apb1963. The documentation is really in need of some examples and additional detail.

Viewing 5 replies - 1 through 5 (of 5 total)