Make woocommerce product attribute unremovable? - wordpress

I have a problem with my Woocommerce. I use my supplier's plugin which very regularly and automatically updates the stock and price of my products. I can, on my supplier's site, request that the product updates of their API linked to my site via their plugin do not erase the titles and descriptions of the products (I modified some of them after adding them ).
Problem: I must add to my products an attribute (example "Color") which is not assigned to them by default (they have two but it is not "Color".)
I can add this attribute to them and define a particular color for them, but when they are updated by my supplier, it overwrites the attributes that were not on my basic products (here the "Color" attribute) .
I wish I could tell their API not to overwrite it, like title or description, but they don't know how to do that..
Do you have an idea ?
I got a start of the trail thanks to this page: https://datafeedrapi.helpscoutdocs.com/article/44-prevent-attributes-from-being-overwritten-during-product-set-updates but the code is for THEIR API and so that the value of an attribute is not erased. For me, it's the ENTIRE attribute that I want to preserve..
Thank you !

Related

How to set catalog_visibility in basic Woocommerce plugin

we need to set the catalog_visibility field (as named in postman) in woocommerce (basic plugin), but it does not seem to work the way we go about it. In wordpress it is the setting under single product on the right side, just below “published on”.
We use an ERP system to push the products to our woocommerce shop and need to find the correct article attribute (we then connect the ERP field with the woocommerce attribute and magic happens ... normally)
When I check the product with postman, the field we want to set is called catalog_visibility.
We thus created a field in our ERP with the exact values visible/catalog/search/hidden as we see in postman and tried assigning the article attribute catalog_visibility and also _visibility (but I think this one is for the extension plugin also called "Catalog Visibility"). Neither one worked.
Interestingly, we found out, that both of the attributes we tried to use (_visibility and catalog_visibility) are now shown on the shop's product page (as a table) under a tab called “additional information”, with the value we tried to transfer.
In the backend it is pushed in to the product “properties” tab.
So it seem the values are pushed into woocommerce, but not where and how we want them to.
Has anyone any idea, which attribute (the name) we need to use, to set the visibility of the product?
Thanks!

How can I build WooCommerce products collections?

I want to build products collections similar to AliExpress,Amazon, Etsy and other collections.
I can suggest you three ways:
You could create new taxonomy called collections, each term would be a collection. You can extend it for your needs by adding custom fields to collection taxonomy terms i.e. image, relations with specific brands ( which also can be created as taxonomy ).
To make final render adjustments, you will have to override archive.php template for your collection taxonomy - i.e. taxonomy-collection.php or taxonomy-collections.php ( depending on slug you choose to use )
You could create new custom post type collections, and then create for product post type additional custom field, that would list in dropdown ( multiselect ) or multiple checkboxes all collections.
You will then need to override single.php template for single custom post type view, i.e. single-collection.php
See: https://developer.wordpress.org/themes/basics/template-hierarchy/ for templates reference.
You could find and install some plugin ( there is a decent number of such ) that offer extending WooCommerce in terms of having brands and collections attached.
I would suggest first approach, or second if you are decent in WordPress and WooCommerce development. Third is at first easiest, but usually lacks of flexibility and customization, since it is not your code.
Wouldn't Grouped products work for you (or anyone searching here)?
https://docs.woocommerce.com/document/managing-products/#section-12
Go to: WooCommerce > Products > Add New.
Enter a Title for the Grouped product, e.g., Back to School set
Scroll down to Product Data and select Grouped from the dropdown. The price and several other fields disappear. This is normal because a
Grouped Product is a collection of ‘child products’, which is where
you add this information.
Publish.
The Grouped product is still an empty group. To this Grouped product,
you need to:
-Create products and add them
-Add existing child products
If you are looking to make collections like those in shopify, for example, grouping products by attributes, or a certain word contained in the title. There is a plugin called WooCommerce Collection by WooExperts. Unfortunately it is a paid plugin. I will give the link below to avoid confusion with another plugin called WooCommerce Collections.
I am not in anyway affiliated to them, I simply use it and it solved this issue for me.
Here is the link: https://wooexperts.com/plugins/woocommerce-collection/

What's the best the approach to add an extra attribute field in Drupal Commerce?

I'm using Drupal Commerce and i have a product type called "Painting" this product type does not have an attribute fields, I'm using inline_entity_form module so i can show the product add form within the node add form for my product display content type.
The product in the site is the painting itself, it may come with a frame or without a frame (the user can choose) and the price will change based on the user's choice, how can i add such field without using attributes fields? as attributes fields requires that the site admin to add many products and put them in one product display, i just want to keep it simple to the site admin, to make him add the product in the same way he adds a node.
Thank you.
This sounds like you just need two variations:
Product one, without frame
Product two, with frame
Each variation has it's own price and title.
You can get by without using an attribute field. Drupal Commerce renders a dropdown when there are no attributes and allows user's to pick from the product variation titles. Since you are using Inline Entity Form this should be seamless for the site admin.

woocommerce: how to add new fields to variations form and show them on frontend

using last versions of wordpress, woocommerce and cheope (theme).
the question: how to
add some extra fields in variations form (text and image field types)
show them on frontend so that their values change accordingly on changing of attributes-select values.
e.g.: the site sells candles and uses variable products, for each kind of candle has several dimensions (with specific different prices), each of which has different duration.
The duration is an important element that I want the user to be informed about.
The same to show the available colors all together.
Unluckily in the standard variation form there is no field where I can insert these or other features.
some help please?
updated 07-August-2013
I succeeded in adding to variations form a new field displayed on back-end, as you can see here, by inserting the code you can find here (please see the comments too) in the function.php file of the theme.
Now, what I’m not able to do is get this field to display with each proper value on front-end (please take a look to the last comment in the above linked page).
Any tip or trick?
thanks
1)Add product attribute and check checkbox Used for variations and Visible on the product page
2)go to variations and add new and fill all fields price and stock must add on them
Your producr display variations and their data

Magento Styling Products in a Particular Category

In Magento, how would I be able to treat products in a particular category differently?
Lets say, I have one category "Specials" and I want to have a bit different presentation of its products from the rest of the catalog products.
I initially thought about hooking custom styles up to the category class name that gets attached to BODY element. That, however, does not seem to be fool-proof, since if you directly access those products, they dont always show up as in that category (assuming cookies or sessions have a say in this) and custom styling is ignored.
Also though about assigning custom layout template to that category, but I am using those as layouts and not styles and I dont want to mix up the uses to avoid issues in the future.
Anyone had this concern before? Thanks for the help!
You have 2 code oriented solutions :
If the notion of "category" is the fact that you're accessing a product through a category (on your product page, the breadcrumb display the category), you'll be able to cehck (somewhere in your catalog/product/view.phtml) the Mage::registry('current_category') which contains your current_category and compare it with your "particular category" (which could be stored as a configration variable)
Otherwise, if you want your style applied even when you're not accessing your product via the category navigation, you'll have to manually check your product categories ($product->getCategoryIds()) and compare it with your "particular category" (which could be stored as a configration variable)
ps: keep in mind that a product can be assigned to multiple categories
Hops this helps you
If you have particular category like special so Create new theme for Only Special category and assign that theme to special category from backend, you can easily assign different theme to different category from category management page in admin.
Or you can aslo assign different theme to products also from manage products page.

Resources