Home Forums Themes Support Claue Getting the Price to appear in text box

Topic Resolution: Resolved
Viewing 36 reply threads
  • Author
    Posts
    • #29330

      Hi,

      I have been in contact with the plugin developers regarding the issue of the price not being automatically added to text box from quick shop button. They have sent me the following message:

      This appears to be a problem with your theme and the popup that’s being created. The suggested price should appear in both locations when you test with the Twenty Nineteen or Storefront themes. I would recommend reaching out to your theme developer to have a look at why the suggested price isn’t display on the shop page and in the text box.

      If you can help me add the suggested price to the Donation Amount (£) text box, that would be great and very much appreciative.

      2. From the Home page, I would like the suggested amount to appear underneath the product name,
      i.e.
      Where Most Needed
      £10

      If I can get 1 & 2 then I can update all the rest of the products. Since currently the rest of the products have the Minimum price and this is displayed however sometimes the donor wants to donate less then minimum amount hence they will not be able to. So the suggested price is the best to use but for Where Most Needed it is not being displayed.

      I really hope you can help with 1 & 2 points.

      Many Thanks again.

    • #29341

      Hi,

      1. Please contact to your hosting support to help you increase WordPress Memory Limit and mySQL version http://prntscr.com/mr98jd

      On my local it show Donate amount but it always get value is 10 http://prntscr.com/mr9dfw if you set minimum price bigger than 10 it will not work, please contact to plugin author about this value doesn’t change when set minimum price bigger than 10

      2. I check on my local it still show amount http://prntscr.com/mr9c39

      Kind regards

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #29434

      Hi Harry,

      Many thanks for your reply and comments.
      I will as advised get in touch with plugin developers and see if they can fix / alter on their side.

      I will let you know how it goes.
      Many thanks.
      Kind Regards,

    • #29462

      Hi Harry,

      I have been in touch with the developer for the plugin and this is their view:

      ——————————————————————————————————————————————-
      2 ISSUES:

      1. Also I have noticed the suggested price does not appear in the Donation Amount (£) text box. If this can be filled this would be great.
      2. On the Home page:
      https://ipac.store/
      For example Where Most Needed the text underneath it, does not have £10 as suggested amount. I would like the suggested amount price underneath the Product Title.

      For issue #1. Name Your Price will fill in the suggested price in the price input by default, even for variable products. Unless, something prevents it from doing so. When i visit your homepage, you appear to be using some custom popup scripts and in my browser log I’m seeing script errors reported: https://cl.ly/8280b3ffaf0e I suspect this is preventing the Name Your Price scripts from running properly.

      For issue #2. These products appear to be Variable products. When a product has a Name Your Price-enabled variation, I have tried to follow the variable product style of price string, ie: “From: $99”. Granted, this isn’t ideal when there’s no minimum price as you can end up with “From: $0.00”. In this case, I tend to think that it’s best to hide the price string, which you can do by adding the following snippet to your theme’s functions.php

      /*
      * Remove Price display for Variable Products with NYP variations.
      */

      function kia_remove_single_price_for_nyp_variable() {
      global $product;

      if( $product->is_type( ‘variable’ ) && class_exists( ‘WC_Name_Your_Price_Helpers’ ) && WC_Name_Your_Price_Helpers::has_nyp( $product->get_id() ) ) {
      remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10 );
      }
      }
      add_action( ‘woocommerce_before_single_product’, ‘kia_remove_single_price_for_nyp_variable’ );

      function kia_remove_loop_price_for_nyp_variable() {
      global $product;

      if( $product->is_type( ‘variable’ ) && class_exists( ‘WC_Name_Your_Price_Helpers’ ) && WC_Name_Your_Price_Helpers::has_nyp( $product->get_id() ) ) {
      remove_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_price’, 10 );
      }
      }
      add_action( ‘woocommerce_before_shop_loop_item’, ‘kia_remove_loop_price_for_nyp_variable’ );

      I hope that helps. Please let me know if you have any further questions about Name Your Price.

      —————————————————————————————————————————————

      I hope we can come to a solution on this matter.
      I await your reply.
      Many Thanks
      Rizwan

       

    • #29474

      Hi Rizwan,

      1. I fixed error js on your site but it still doesn’t show price amount. I check on single product page with my theme it work well but on quickview the value of Donate amount always is $10 it not get minimum price

      2. I check default theme Twenty Nineteen it also doesn’t support show Suggest Price on catalog page with variable product but it work with simple product.

      The code suggest by plugin author will remove all prices (minimum price) it only keep suggest price for simple product not for variable product.

      Kind regards

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #29904

      Hi,

      I have been in touch again with plugin developer and they have suggested:

       

      This is a custom popup implementation. Name Your Price is fully compatible with WooCommerce.com’s Quick View plugin but it can’t be guaranteed to work with every other popup plugin. That said, it appears that the NYP scripts aren’t running there as the suggested price should be pre-filled in the input.

      1. The NYP script doesn’t appear to be loaded at all as I don’t see http://ipac.store/wp-content/plugins/woocommerce-name-your-price/assets/js/name-your-price.js in your page source.

      2. Once enqueued and loading you may need to mimic what I’m doing to add compatibility with Quick View: which is re-initialize the NYP scripts once the popup is loaded (because NYP is not there on page load like in the default setup). Here’s how I’m doing that as an example:

      /**
      * Run when Quick view item is launched.
      */
      $( ‘body’ ).on( ‘quick-view-displayed’, function() {
      $( ‘body’ ).find( ‘.cart:not(.cart_group)’ ).each( function() {
      $( this ).woocommerce_nyp_update();
      } );
      } );

      Please have a look at the suggestion above. I hope something can be arranged to allow the price to be pre-populated.

      For your information:

      On the home page:

      https://ipac.store

      Where Most Needed – is using Suggested Price

      Where as the other Products (Donations) are using Minimum Price.

      Would ideally prefer – Where Most Needed – is using Suggested Price since I can add my won price, however for this case I need

      1. Price to be per-populated in Donation Amount ( £ )

      2. The Price of £10 to appear on the home page under Where Most Needed.


      I really need to take site live asap and would appreciate your help in this matter.
      Many Thanks
      Kind Regards,
      Rizwan

    • #29924

      Hi,

      I added code to claue-child > functions.php but it doesn’t work.

      <?php
      function myscript() {
      ?>
      <script type="text/javascript">
      	(function( $ ) {
      	"use strict";
      		$( 'body' ).on( '.mfp-ready .product-quickview.nyp-product', function() {
      			$( 'body' ).find( '.cart:not(.cart_group)' ).each( function() {
      			$( this ).woocommerce_nyp_update();
      			});
      		});
      	}) ( jQuery );
      </script>
      <?php
      }
      add_action( 'wp_footer', 'myscript' );
      ?>

      Please ask plugin author check this function.

      Kind regards

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #29937

      Hi Harry,

      I have sent your reply to plug-in developer and see what the next steps are.

      In terms of the second request for:
      2. The Price of £10 to appear on the home page under Where Most Needed.

      Can you please have a look at this?
      Many Thanks
      Kind Regards,
      Rizwan

    • #29938

      Hi Harry,

      Also I noticed as the plugin developer noticed that on the Quick View page from Home page:

      If you view source on this page as developer of plugin says:

      1. The NYP script doesn’t appear to be loaded at all as I don’t see http://ipac.store/wp-content/plugins/woocommerce-name-your-price/assets/js/name-your-price.js in your page source.

      Please can you have a look and see how name-your-price.js can be loaded on this Quick view page.

      M nay Thanks
      Rizwan

    • #29945

      Hi Harry,

      Hi Kathy,

      Wanted to login:
      https://ipac.store/wp-admin/

      However I can seeing a blank page.

      Just wanted to know if you were working on anything on site?
      I hope you can help, it was ok last time I checked yesterday.
      Many Thanks,
      Rizwan

    • #29947

      Hi Rizwan,

      Did you use a plugin to change login path? Or do anything? Please use this link to login https://ipac.store/my-account/

      Kind regards

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #29948

      Hi Harry,

      No I did not change anything. I thought it might have been some updates you might have done, while you where working on the issues above.

      I entered login detailed and got the following error massages;

      I hope you can help.
      If I change the path via ftp from
      /wp-content/plugins/
      and rename the plugins folder, I still get the blank screen on wp-admin page.

      I hope you can help.
      Kind Regards,
      Rizwan

    • #29949

      Hi Rizwan,

      I remove the code i added in functions.php it now the admin link work.

      To load file name-your-price.js please download, extract attach file and upload to claue-child and change the code in claue-child > functions.php line 12 to 15 from

      function jas_claue_enqueue_script() {
      	wp_enqueue_style( 'jas-claue-parent-style', get_template_directory_uri() . '/style.css' );
      }
      add_action( 'wp_enqueue_scripts', 'jas_claue_enqueue_script' );

      to

      function jas_claue_enqueue_script() {
      	wp_enqueue_style( 'jas-claue-parent-style', get_template_directory_uri() . '/style.css' );
      	if ( class_exists( 'WC_Name_Your_Price' ) ) {
      		wp_enqueue_script( 'jas-claue-custom-script', get_template_directory_uri() . '/name-your-price.js' );
      	}
      }
      add_action( 'wp_enqueue_scripts', 'jas_claue_enqueue_script' );

      Kind regards

      Attachments:
      You must be logged in to view attached files.

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #29952

      Hi Harry,

      Thanks I have done that and viewing souse now gives the link to:
      https://ipac.store/wp-content/themes/claue/name-your-price.js?ver=5.1.1

      However the Donation Amount (£) is still blank.
      I hope we can get a solution to this.

      Many Thanks
      Rizwan

    • #29953

      Hi,

      I editied the line to:
      wp_enqueue_script( ‘jas-claue-custom-script’, get_template_directory_uri() . ‘-child/name-your-price.js’ );

      Now when I view source it it showing the correct URL to:

      https://ipac.store/wp-content/themes/claue-child/name-your-price.js?ver=5.1.1

      However still not filling the amount in text box.
      Hope you can help.

      Rizwan

    • #29955

      Hi Rizwan,

      Please contact plugin author and ask more.

      Kind regards

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #29956

      Hi Harry,

      Thank you and will ask plugin developer.
      Many Thanks and lets see what is said and will get back to you.

      Thanks,
      Rizwan

    • #29990

      Hi Harry,

      Been in contact with plugin developer and their reply is below;

      ===================================================================================

      Rizwan,

      To reiterate my last message, to achieve compatibility you need to 1. Load the script and 2. Initialize the script when the pop up is loaded.

      I saw the script they wrote and it’s a step in the right direction. But the name your price input is not in the DOM on page load since it’s in the pop-up and so that script will not work. Look again at the script integration with Quickview… Specifically at the .on() part.

      Quickview has a custom event that fires when a pop-up is loaded. Your theme will need the same. And then you can listen for the custom event and fire the NYP scripts when the chain event is triggered.

      The theme may also want to take a look at how quickview provides a hook wc_quick_view_enqueue_scripts specifically for enquing scripts wherever their popups are displayed.

      Please don’t need to copy the NYP script into your theme. There’s no need and you’ll get locked into an old version when NYP updates. The script is registered the WordPress way and so can be enqueued by it’s handle. Even better this will load all styles, scripts, and JavaScript variables.

      WC_Name_Your_Price()->display->nyp_scripts();

      Should be able to use it like this. Apologies for formatting, I’m away from my keyboard:

      function kia_load_nyp()
      if( function_exists( ‘WC_Name_Your_Price’ ) ){
      WC_Name_Your_Price()->display->nyp_scripts();
      }
      add_action( ‘wp_enqueue_scripts’, ‘kia_load_nyp’, 30 );

      I hope that helps, but it really depends on whether your theme has the needed custom events.

      Cheers,
      Kathy

      Kathy
      Lead Developer
      kathyisawesome.com

      ================================================================================

      I hope , trust we can solve this issue and get it working.
      Appreciate your help in this matter.

      Kind Regards,
      Rizwan

       

    • #30001

      Hi Harry and Rizwan,

      The snippet for enqueing the NYP script should have been:

       

      function kia_load_nyp() {
          if( function_exists( 'WC_Name_Your_Price' ) ){
              WC_Name_Your_Price()->display- >nyp_scripts();
          }
      }
      add_action( 'wp_enqueue_scripts', 'kia_load_nyp', 30 );

      My apologies, I was away from my keyboard when typing that, but can confirm that it will load the NYP script everywhere. Please avoid copying the NYP script into your theme. There’s no reason to do this. It will lock users into outdated versions of the script and set me up for difficult support tickets down the road trying to sort out why the script may not be behaving properly.

      <?php do_action( ‘woocommerce_quickview_before_ thumbnail’ ); ?>

      is not satisfactory for adding the custom JavaScript listener since it’s a PHP hook, though maybe if that’s only displayed in the popup itself, you could print the relevant script there?

          $( 'body' ).find( '.cart:not(.cart_group)' ).each( function() {
             $( this ).woocommerce_nyp_update();
          } );

      And possibly change body to whatever the popup is? I’m not sure. I’m more familiar with the custom jQuery event/listener setup that I use for compatibility with QuickView and Composite Products. So I think you’ll need something like:

      $(‘body’).trigger(‘quick-view- displayed’);

      somewhere in your Javascript when the popup opens. Magnificent Popups has an open callback, see the API:https://dimsemenov.com/plugins/magnific-popup/documentation.html#api

      perhaps you could add a custom event trigger there. Or their docu says “all Magnific Popup events are also dispatched using triggerHandler on target element (or to document if the element doesn’t exist).” so the custom event may already be there, I just don’t know what it’s called.

      Once you have a custom Javascript event that fires when the popup is loaded you can duplicate what I am doing for Quick View compatibility and reinitialize the NYP script now that the price input is in the DOM.

      /**
      * Run when Quick view item is launched.
      */
      $( 'body' ).on( 'your-custom-event', function() {
          $( 'body' ).find( '.cart:not(.cart_group)' ).each( function() {
             $( this ).woocommerce_nyp_update();
          } );
      } );
      
      
      

      That’s all I can think of from my side to explain how NYP works, but let me know if you have any further questions.

       

      Cheers,

      -Kathy

      Lead Developer: Name Your Price

    • #30016

      Hi Kathy / Harry,

      Many Thanks for your support and help. I trust Harry can have a look at your suggestions and see what can be done.
      Kind Regards,
      Rizwan

    • #30022

      Hi Rizwan/Kathy,

      I check your plugin on my local it only get value=”10″ while minimum price is different value. http://prntscr.com/n4g2t7

      And on Rizwan’s site it doesn’t get value so it can’t show amount http://prntscr.com/n4g4be

      Could you help us check this.

      Thanks

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #30023

      Harry,

      Here’s what a variable product with a name your price-enabled variations is meant to look like on the single product page:

      https://wp5-helgatheviking.c9users.io/product/variable-nyp/

      The input will show the suggested price for that variation. If there’s no suggested price set, it will try to show the minimum price, unless “hide minimum” is enabled. Since it’s possible for every variation to be Name Your Price-enabled and therefore have different suggested/minimum prices… the input’s value is set via Javascript (specifically jQuery). And finally, if you try to enter a price that is below the minimum you will get an error notice.

      So if this is not happening I would guess that you haven’t initialized the Javascript function properly. Because the input is not in the DOM when the page loads the NYP script won’t _do_ anything. As I’ve written above, it must be initialized on some event that occurs when the popup opens.

      Sidenote: you seem to have some PHP notices in your product image template.

      Notice: Undefined variable: post_thumbnail_id in /home/ubuntu/workspace/wp-content/themes/claue/core/libraries/vendors/woocommerce/templates/single-product/product-image.php on line 103

      Notice: Undefined variable: post_thumbnail_id in /home/ubuntu/workspace/wp-content/themes/claue/core/libraries/vendors/woocommerce/templates/single-product/product-image.php on line 111

      Notice: Undefined variable: zoom in /home/ubuntu/workspace/wp-content/themes/claue/core/libraries/vendors/woocommerce/templates/single-product/product-image.php on line 118

    • #30027

      Hi Kathy,

      When i don’t put suggest price, just minimum price.

      The minimum price is $25 but the amount only show $10 http://prntscr.com/n4pmi4

      Could you check on your develop site.

      Kind regards

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #30031

      Harry,

      This seems like a different issue…but it’s possible to do if you’ve set a suggested price of $10 even though that’s lower than the minimum price of $25. The plugin will show a warning in the admin when you do this, but it doesn’t stop you. You will then fall into the known accessibility bug of not being able to click on the add to cart button until you click outside of the text input. I’m working on revising that in NYP 3.0, but for now the best way to avoid it is to provide a suggested price that is higher than the minimum.

      By reading the magnific popup source code I was able to determine the eventhandler they use is named mfpOpen. With that information is possible to initialize the NYP scripts on this event.

      Here’s a plugin that should add compatibility:

      https://gist.github.com/helgatheviking/bc372086690e5d315e7aced3aeb1062b

      You can see it working here on the Variable NYP product:

      https://wp5-helgatheviking.c9users.io/shop/page/3/

      Cheers,

      -kathy

       

       

    • #30036

      Hi Kathy,

      Thank you so much for your work. The code it now work excellent.

      @Rizwan I added the code Kathy did on your site, it now work well.

      Have a great weekend guys!

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #30051

      Hi Kathy / Harry,

      Many Thanks for all your help with this, it is much appreciative and without your help this would have not been possible, so I really do appreciate your knowledge and problem solving skills in directing Harry. Harry many thanks also for using Kathy ‘s method, it works very well and is very much appropriated from both of you.

      I know just have the final dilemma to solve:

      Since the site is a Donation, ideally I would like the Donor to Donate however much they can afford. So for example for WATER which is set as a minimum price of £30 and the Donor only has £10 would like him to be able to Donate £10 for Water. So in this case we can use the method of Suggested price as in the example of WHERE MOST NEEDED on home page however it throws up some issues which need to be solved:

      1.  Under Where Most Needed text on Home page, I need the suggested price to be displayed as in this case £10 below the text as it is in Water £30.


      2. I am using a plugin called – Phone Orders for WooCommerce (Pro)

      Phone Orders for WooCommerce (Pro)

      I am using this to take Donations from Donors when they call the Charity. The primary aim is to login, search for an existing Donor and if they exist to assign a Donation Allocation (i.e Water, Food etc..) to them and then checkout as you would normally from the website and once all complete to go back to the main phone donation page again which is @

      https://ipac.store/phone-orders-frontend-page

      Now this issue I have here is when you click on:
      Find Products…
      and type in Where Most Needed
      It will auto complete and find the following:

      However as you can see the price is From: £0.00. It is not pulling the suggested price. So I can see from view script it is not loading the name-your-price.js file, so is this a similar issue to the problem which was just solved by using:
      https://gist.github.com/helgatheviking/bc372086690e5d315e7aced3aeb1062b

      If you could help with these issues what would be much appreciated and would enable us to start taking the site live and hopefully benefit those who are in Need.

      Else

      If 1 & 2 where tricky, then to have the ability somehow for a Donation of lower than the minimum price to go through in the shopping cart and be added, this would means all the other Donation Allocations we have on the home page

      https://ipac.store/

      Except Where Most Needed would work and I could change this to a minimum price also.

      Any suggestions or help in this matter would be very much appreciated. I really do appreciate all the help so far also.

      Kind Regards,
      Rizwan

    • #30052

      Rizwan,

      However as you can see the price is From: £0.00. It is not pulling the suggested price.

      It never has for variable products. Variable product price strings are tricky and I’ve tried to follow along with the WooCommerce approach of showing “From: $X” where X is the lowest price… in NYP’s case the lowest minimum. Which has it’s own problems if there is no minimum.

      Could you make do with each product being a simple product in lieu of a variable product? They are a lot easier to work with. You’ll automatically get a “Suggested Price” string which can be modified from the settings.

      Poster with text below reading "suggested price: $100"

      Since your variations don’t seem to change the price at all, perhaps the info would be better stored as a Product Addon style field.

      As a variable product the price string is a lot more difficult to generate and NYP hasn’t been stashing it’s suggested prices in the price transients. However, if the suggested amounts are the same across all variations you could perhaps get away with the following, though it may not be very performant. You only have 3 variations, so perhaps get_children() won’t be that slow.

       

      /**
      * Change price string for Variable Products .
      */
      function kia_filter_variable_product_price_html( $html, $product ) {
        $children = $product->get_children();
        if( ! empty( $children) ) {
          foreach( $children as $child_id ){
            $html = WC_Name_Your_Price_Helpers::get_suggested_price_html( $child_id );
            break;
          }
        }
        return $html;
      }
      add_filter( 'woocommerce_variable_nyp_html', 'kia_filter_variable_product_price_html', 10, 2 );

       

    • #30058

      Hi Kathy,

      Many Thanks for your help and suggestions, it is much appreciated.

      “Could you make do with each product being a simple product in lieu of a variable product? They are a lot easier to work with. You’ll automatically get a “Suggested Price” string which can be modified from the settings.”

      I tried this and can be seen on Home page:
      https://ipac.store/

      It fixed the issue of showing the amount under Where Most Needed, however since a minimum price is not set, I still would get From: £0.00 from:

      https://ipac.store/phone-orders-frontend-page

      When Searching for Where Most Needed

      However, if the suggested amounts are the same across all variations you could perhaps get away with the following, though it may not be very performant. You only have 3 variations, so perhaps get_children() won’t be that slow.

      Yes suggested amounts would be the same.
      Would your script:

      /**
      * Change price string for Variable Products .
      */
      function kia_filter_variable_product_price_html( $html, $product ) {
      $children = $product->get_children();
      if( ! empty( $children) ) {
      foreach( $children as $child_id ){
      $html = WC_Name_Your_Price_Helpers::get_suggested_price_html( $child_id );
      break;
      }
      }
      return $html;
      }
      add_filter( ‘woocommerce_variable_nyp_html’, ‘kia_filter_variable_product_price_html’, 10, 2 );

      Be able to do 1 & 2 from request above, add price text under product name, and add From: £(suggested price), when searching on the page:
      https://ipac.store/phone-orders-frontend-page

      If this is the case, it would be great and fix these issues.
      If this is the case, then Harry can you please add this script to get the suggested price to appear

      Below the middle Where Most Needed, which is a Suggested price for a variable product.

      I will make a request to the developer of the Phone Orders for WooCommerce (Pro) plugin to use this script to get the From: £(suggested price) also.

      Many Thanks or all your help, it is much appreciated.
      Kind Regards,
      Rizwan

    • #30059

      If Suggested Price: $10 is not appearing for the simple product, then something must be interfering, either the theme or another plugin. NYP is set to filter the price html via the woocommerce_get_price_html filter, but if your loop is not calling:

      $product->get_price_html()

      to display the price HTML, then there’s nothing I can do on my end. I would recommend that you take a look at how Name Your Price behaves under default circumstances… ie: only WooCommerce and Name Your Price enabled and using a default theme such as Twenty Nineteen (or Storefront). This will give you a good sense of how Name Your Price is expected to behave so that when it doesn’t behave that way you will know where to look.

      I really think that Simple Products will be easiest in the long run as my other code is hackish, non-performant, and a workaround for something that could be resolved by switching to Simple Product types.

      My script above does not include the “From:” string, but you can add it:

      $html = wc_get_price_html_from_text() . WC_Name_Your_Price_Helpers::get_suggested_price_html( $child_id );

      I can’t speak for the Phone Orders developers but if it were me, I would not add my script to their plugin. It’s site-specific and so belongs in a custom plugin on your site (or possibly a child theme).

       

    • #30060

      Hi Kathy,

      Sorry I think their is some misunderstanding. The suggested price £10 is displaying on theme for simple product.

      I tested it, it is the right hand Where Most Needed Simple Product.
      The middle one is the old Variable suggested price
      And the right is the minimum price one.

      Its just the Phone Orders for WooCommerce (Pro) plugin for Simple  & variable Products does not display the price and only will if I assign a minimum price.

      Thank you for child theme suggestion and this would be the best way, if we use your code.
      Many Thanks again for your help and advice.
      Much Appreciated,
      Rizwan

    • #30101

      Hi Harry,

      Please can you see if you can get the price to appear underneath Where Most Needed for Variable suggested price, please see image above, (the middle image).

      Hopefully you can use the script Kathy has written to get the value, and get it displayed under the image.
      Many Thanks for your continued support.
      Kind Regards,
      Rizwan

    • #30102

      Hi Harry,

      As the issue of suggested price for variable products was solved, please can you have a look at using the same method to add the suggested price to the autocomplete drop down here:

      https://ipac.store/phone-orders-frontend-page

      Now this issue I have here is when you click on:
      Find Products…
      and type in Where Most Needed
      It will auto complete and find the following:

      However as you can see the price is From: £0.00. It is not pulling the suggested price. So I can see from view script it is not loading the name-your-price.js file, so is this a similar issue to the problem which was just solved by using:
      https://gist.github.com/helgatheviking/bc372086690e5d315e7aced3aeb1062b

      If you could help with these issues what would be much appreciated and would enable us to start taking the site live and hopefully benefit those who are in Need.

      The plugin developer has suggested to use this hook to tweak text in product autocomplete .

      add_filter( ‘wpo_autocomplete_product_custom_output’, function($custom_text, $product ){
      $custom_text = $product->get_id(). ” – ” . $product->get_name();// add more fields?
      return $custom_text;
      },10,2);

      Any help in this matter would be greatly appreciated.
      Many Thanks
      Rizwan

    • #30105

      Hi,

      1. @Kathy, @Rizwan if i add below code it will show suggest price but hide minimum price on catalog page http://prntscr.com/n67df5

      /**
      * Change price string for Variable Products .
      */
      function kia_filter_variable_product_price_html( $html, $product ) {
        $children = $product->get_children();
        if( ! empty( $children) ) {
          foreach( $children as $child_id ){
            $html = WC_Name_Your_Price_Helpers::get_suggested_price_html( $child_id );
            break;
          }
        }
        return $html;
      }
      add_filter( 'woocommerce_variable_nyp_html', 'kia_filter_variable_product_price_html', 10, 2 );

      2. @Rizwan

      The code

      add_filter( 'wpo_autocomplete_product_custom_output', function($custom_text, $product ){
          $custom_text = $product->get_id(). " – " . $product->get_name();// add more fields?
          return $custom_text;
      },10,2);

      The price will hide in auto complete form http://prntscr.com/n67ezd, http://prntscr.com/n67f2w and you can add custom code in claue-child > functions.php

      Kind regards

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #30114

      Hi Harry,

      Many Thanks for your help.

      2. @Rizwan
      2. Since I need the price to be added, the developer has suggested:

      you can tweak this code to adjust price for cart item

      add_filter(“wpo_prepare_item”, function($item, $product){
      if($item[‘item_cost’] == 0)
          $item[‘item_cost’] = 10;
      return $item;
      },10,2);

       

      I hope this helps and we can pull the suggested price into the cart.

      1. @Kathy, @Rizwan if i add below code it will show suggest price but hide minimum price on catalog page http://prntscr.com/n67df5

      If we can get item 2. fixed in terms of pulling the suggested price into the auto complete drop down and then that populating the cart form, then what you have done here:

      http://prntscr.com/n67df5

      Is fine, since I will not need to use Minimum price on the home page (https://ipac.store/) , however use  the Suggested price, which will complete my requirements for OPTION 1 (on page 2 of this thread)

      I will then be able to change all Donations / Products into Suggested prices.

      Many Thanks for your help and continued support.
      Kid Regards,
      Rizwan

       

    • #30115

      To be able to sort by price, the minimum price is saved as the price. But this should not be displaying in the loop unless the loop displays $product->get_price() instead of $product->get_price_html(). The latter has the filters that NYP attaches to. ( Also possible that something is already filtering the woocommerce_get_price_html )

      I still believe that variable products are over-complicating things and that switching to simple products will save a lot of headaches.

    • #30116

      Hi Kathy,

      Many Thanks for your help and advice.

      Its just the Phone Orders for WooCommerce (Pro) plugin for Simple & variable Products does not display the price and only will if I assign a minimum price.

      I would have used Simple Products if they align with our requirements, however even with Simple Products, I will have this issue of not displaying the suggested price @

      One of the Where Most Needed Donations is a Simple Product, with suggested price however this price is not displayed in the image above, which is not over-complicated.

      I hope we can find a solution and appreciate all your help.
      Many Thanks,
      Rizwan

    • #30135

      Hi Harry / Kathy,

      Many Thanks for your help in displaying the piece on Home Screen for Variable / Suggested price.

      1. @Kathy, @Rizwan if i add below code it will show suggest price but hide minimum price on catalog page http://prntscr.com/n67df5

      /**
      * Change price string for Variable Products .
      */
      function kia_filter_variable_product_price_html( $html, $product ) {
      $children = $product->get_children();
      if( ! empty( $children) ) {
      foreach( $children as $child_id ){
      $html = WC_Name_Your_Price_Helpers::get_suggested_price_html( $child_id );
      break;
      }
      }
      return $html;
      }
      add_filter( ‘woocommerce_variable_nyp_html’, ‘kia_filter_variable_product_price_html’, 10,

       

      I have used this script and updated all products to Suggested price.

      Another good price of news is that the Phone Plugin developer managed to add Suggested price to auto search drop down. So from my requirements for OPTION 1, they are all complete.

      Many Thanks for yourself Harry and Kathy, since without your help and coding skills this would not have been possible.

      Great Support and help and always much appreciated.
      Kind Regards,
      Rizwan

Viewing 36 reply threads

You must be logged in to reply to this topic.