How i can hide attribute "Ships From" in product page

Status
Not open for further replies.

MisterMay

New Member
Hi,

Sorry, it did work on a standard version of Wordpress, but stops working when Alidropship is installed. It appears that the plugin takes over the attributes section of the product page, and overwrites woocommerce. I have contacted the support team to figure out why, and to find out if this could be implemented within the plugin code. Will let you know.

My problem with using the other method of unticking the boxes is that those options disappear from the variations, and will affect the syncing of stock levels. If the plugin cannot determine the 'ships from' location (as this field is no longer in the product variations), then surely it will have issues setting the stock levels?

Will continue to investigate and will try to find another solution.
 

Direct Webstore

Well-Known Member
My problem with using the other method of unticking the boxes is that those options disappear from the variations, and will affect the syncing of stock levels.

No they don't. They are only hidden from the customer on the product page, but still active. When you place the order the shipping options are there for you to choose from. It's only when you "delete" them that syncing is stopped. This has already been covered in this thread.

I have contacted the support team to figure out why, and to find out if this could be implemented within the plugin code.
Good idea.

will try to find another solution.
In the meantime ... selecting the default shipping origin and unticking those two boxes only takes a few seconds and works.

Compared to the other tasks that need to be done when editing a product like deleting the "Brand" and other crazy items from Attributes, editing the title and writing an original description ... the few extra seconds selecting a location and unticking two boxes is not really a hassle. Especially when not every product has "Ship from" options.

:)

EDIT: I suggest you edit that first post of yours before anyone wastes time setting up a child theme and implementing the file edits and then wonder why it doesn't work ... until they get to here on the next page.
 
Last edited:

ekrcic

New Member
I found solution which works for me.

1. Delete all "Ship From" atributes except "China"
2. Change "Ship From" to "Shipping"
3. Change "China" to "Free"

Inventory update still works and variations prices (if different) still change.

(AliDropship plugin, DaVinci theme)
 

Direct Webstore

Well-Known Member
I found solution which works for me.

1. Delete all "Ship From" atributes except "China"
2. Change "Ship From" to "Shipping"
3. Change "China" to "Free"

Inventory update still works and variations prices (if different) still change.

(AliDropship plugin, DaVinci theme)
That's one of the options others have suggested already ... with the exception of changing China to "free". Good idea. :)
 

Direct Webstore

Well-Known Member
Maybe I am wrong, but I think it wasn't menchioned that you can erase all but one atribute.
No ... You're right. Sorry. Half asleep here down in the Southern Hemisphere .. :) Good idea. But for me, I'll just stick to hiding it completely. Less stuff to confuse/distract customers.
 

pzovcrqt

New Member
Any update on this solution?
I contacted Alidropship support on this without answers already?

OK, I have found a solution that works for me, but it does require a bit of simple coding.

Firstly, you need to create a child theme, as any changes you make will be lost if there are any woocommerce or theme updates. It's a fairly easy thing to do, and there are plenty of youtube tutorials on the subject. Once you've created your child theme, make sure it is activated in the wordpress theme admin (you will need to keep your original theme installed, but don't activate it).

Second, you need to copy over a file from your woocommerce folder to the child theme. The file you need is called variable.php and is located in;

wp-content/plugins/woocommerce/templates/single-product/add-to-cart

Paste this file into the following folder (you will need to create the folders if they do not exist);

wp-content/themes/your-theme-child/single-product/add-to-cart

Next, go open the variable.php file located in your child theme with a code editor (most hosting services allow you to do this within their control panel). Locate the following line of code;

<?php foreach ( $attributes as $attribute_name => $options ) : ?>

Directly under this line, paste the following piece of code;

<?php
if ( $attribute_name == 'Ships From' ){
continue;
}
?>

Then save the file. This is all the coding you need to do.

What this will do is keep the attribute live, but hide it from view. You will not need to change or remove any of the attributes or variations in your product page, but you will need to set your 'Ships From' default setting in the variations to the country of your choice (e.g. China). Customers will only be able to see and select the other options that are available (e.g. size, colour, etc), but the 'ships from' option will be hidden from them and will be set automatically when they add to cart.

Because we are not changing any of the attributes or variations in the product's admin page, all stock and price changes will be updated automatically when synced.

I know it may sound a little daunting, but this is a one time job that will save hours of tweaking and playing around with attributes and variations for every single product. It has definitely worked for me.

Hope this helps, and let me know if there is anything you don't understand.
 

pzovcrqt

New Member
The problem could be expressed differently.
How to modify the variable.php from woocommerce/single-product/add-to-cart file when alidropship extension is enabled ?
 

the_lyall

Active Member
The problem could be expressed differently.
How to modify the variable.php from woocommerce/single-product/add-to-cart file when alidropship extension is enabled ?
Even if you change that file to stop it being displayed on the product page, it is being preset by the default you are selecting on the product page, so it will still be listed as an attribute/option against the product in the cart, checkout, order details pages and the order confirmation email.

The better option is to disable the attribute from being used for variations, and accept that you need to manually click 'China' when placing the order with the supplier through WooCommerce. It still adds the product to the order automatically, you just need to tell it which country option you want. That way it's completely invisible to the customer, which I assume is what you're trying to achieve.

As far as I'm aware that's the only way to completely stop it from being visible, without adding a load of custom code.
 

Direct Webstore

Well-Known Member
The better option is to disable the attribute from being used for variations, and accept that you need to manually click 'China' when placing the order
They are only hidden from the customer on the product page, but still active. When you place the order the shipping options are there for you to choose from. It's only when you "delete" them that syncing is stopped. This has already been covered in this thread.
Starting to go in circles on this thread. The solutions are all here already for anyone who cares to read/search. The only one not mentioned yet is to hide the shipping selection with CSS. But it has been mentioned in "other" threads on this topic. Not sure if that would work though.

It's also been discussed to death in Google land, you may find a more suitable solution than the ones already here in this forum ... https://www.google.com/search?q=Hid...on&aqs=chrome..69i57&sourceid=chrome&ie=UTF-8
 
Last edited:

chris37

Well-Known Member
I rewrite it here without the mean words;)


1) For the code in my site to work i must to have the attribute i want to hide to Default Form Values: Nearest warehouse (or any variation you want to hide) from the products page variation setting.

2) See screenshot before my code apply https://snipboard.io/T37Yfe.jpg

3) I apply this css code

[data-value=nearest-warehouse]
{
display:none !important; !important;
}


[for=pa_1ef722433d607dd9d2b8b7]
{
display:none !important; !important;
}

see screenshot how is look now https://snipboard.io/v4Iq5d.jpg

4) I test and automatic order for i prove to everybody is working see screenshot https://snipboard.io/WDcb9L.jpg (as you can see here is still add the ship from nearest warehouse because is selected by default from Default Form Values: ) .If already selected, is always working because the customer dont need to do it.

5) Your css code is must be create for you specific setting and you have to make each one for different values, for example the "ship from" and the "shipping from" are two different values and must be create two different css code for hide them.

6) Important Note : if the seller (aliexpress) change one single thing from his setting is gonna break the connection from aliexpress, when you go to reset the product if the seller change the attribute from it end you must to create and new css code as well for be hide again.

7) the reason 6 is why i just rename the variation and i dont complicate the thing.

8) I wish now to stop everybody about this subject i believe i close it one and for all.:cool:
 

Mar

Moderator
Starting to go in circles on this thread. The solutions are all here already for anyone who cares to read/search. The only one not mentioned yet is to hide the shipping selection with CSS. But it has been mentioned in "other" threads on this topic. Not sure if that would work though.
I have tried the CSS code, one time it work, another time it don't. I tried it out of curiosity but I don't really have a plan to implement it permanently. This is a complicated area that would cause the 'ADD TO CART' button not active and the product cannot be ordered in exchange of 'Ship From' attribute removed, which personally is not worth and something I can very much live with and don't bother me a bit. I don't believe customers will not buy because of the Ship From option. That is my personal view of the matter, for those who is willing to take the risk, that is your call.
 
Status
Not open for further replies.
Top