Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › Remove +$ option from shipping variation dropdown.
- This topic has 7 replies, 3 voices, and was last updated 10 years, 7 months ago by vshahoian.
-
AuthorPosts
-
April 7, 2014 at 11:59 pm #10627vshahoianMember
Currently, i have a shipping variation for usa and canada, and in the shopping cart, it shows the dropdown as US +$0 and Canada +30. I want to get rid of the price displayed and simply have a option for US and canada, without the dollar amount being displayed. How can I go about doing this?
I’ve included screen shots:
How it looks now:
[http://i.imgur.com/VbuXMA3.jpg]
How I need it to look:
[http://i.imgur.com/Juk3fOQ.jpg]
April 8, 2014 at 3:58 am #62166adminKeymasterHow much will be charged for shipping to “Canada” then?
April 8, 2014 at 6:30 am #62167vshahoianMemberit’s still going to be +30, that will be reflected elsewhere in the cart and within paypal, however, the dropdown doesnt look the way i want it to when it displays the information
just to clarify, i still want it to charge 30 dollars more for canada shipping automatically, and i want everything to function the way it does, i just want the +$30 to not appear in the dropdown.
April 9, 2014 at 3:45 am #62168adminKeymasterI see what you mean. The cart can’t do that. It needs that value there because thats the value it takes when an user selects that shipping option and the value is applied to the cart’s shipping.
April 9, 2014 at 6:27 am #62169vshahoianMemberCan you show me where in the database or in what file it’s pulling the information to populate the dropdown?
April 9, 2014 at 6:28 am #62170vshahoianMemberYou should be able to modify what’s populated while keeping the original amount the same.
April 9, 2014 at 1:50 pm #62171wzpModeratorThe behavior of product & shipping variation dropdowns is hard coded into the plugin. So, if you are really-really-really wanting to do this…
********** DANGER WILL ROBINSON — Running With Scissors Ahead **********
********** DANGER WILL ROBINSON — Running With Scissors Ahead **********
********** This section addresses PRODUCT VARIATIONS **********
look inside the eStore_button_display_helper.php file for the get_variation_and_input_code() function definition.
eStore supports up to 4 variations; you will see references to variation1,variation2, variation3 and variation4. Remember, variation1 to variation3 are physical products and variation4 is digital.
This is a very old section of code… that is why it looks the way it does; with separate code sections for each of the variations.
Within each variation’s code section, are references to $pieces1[] to $pieces4[] arrays. Each of these arrys controls what is shown in the dropdown menu, for each of the 4 variations.
Each of the $pieces1[] to $pieces4[] arrays is processed inside of their own FOR loop. It is here that you can change what is displayed in the dropdown menus. Each array is exploded, and their contents are used to build $tmp_txt which is then used to build the option value in the dropdown menu. As each variation string is exploded, index 0 contains the option name, and index 1 contains the price.
You need to be very careful about what you modify, as $tmp_txt is used not only as the the dropdown option text, but also as the value. Thus, you have to modify the code, so that the dropdown text changes, but the dropdown value remains intact.
For instance; Let’s say we wanted to not display the price for the second variation, known as variation2. At the bottom of the FOR loop for variation2, you might change the line that says:
$var_output .= ‘<option value=”‘.htmlspecialchars($tmp_txt).'”>’.$tmp_txt.'</option>’;
To:
$var_output .= ‘<option value=”‘.htmlspecialchars($pieces2[0]).'”>’.$tmp_txt.'</option>’;
Causing variation2’s dropdown to only display the option, but not the price.
Please make a backup of the eStore_button_display_helper.php file before you begin; as rescuing you from PHP hacking adventures is beyond the scope of the support forum.
********** This Section Addresses SHIPPING VARIATIONS **********
Open the eStore_cart.php fie…
Now look for the eStore_cart_display_shipping_variation_part() function definition…
You will see a FOR loop, very similar to the ones used for the product variations…
At the bottom of the FOR loop is a line that says:
$var_output .= ‘<option value=”‘.htmlspecialchars($pieces2[0].”|”.$pieces2[1]).'” ‘.eStore_is_shipping_option_selected($pieces2[0]).’>’.$tmp_txt.'</option>’;
At this point, based on the previous explanation for product variations, you know what to change. Please make a backup of the eStore_cart.php file before you begin; as rescuing you from PHP hacking adventures is beyond the scope of the support forum.
April 9, 2014 at 9:44 pm #62172vshahoianMemberPerfect, this is all I needed, you rock! Thank you.
-
AuthorPosts
- You must be logged in to reply to this topic.