WooCommerce duplicate slugs for categories - woocommerce

I am trying to setup a mobile store with woocommerce and I have some problems when I am creating categories.
For an example;
Category 1 :
Product Apple
Category 2 :
Product apple
and I want to display the URL like below
www.site.com/category-1/product-apple
www.site.com/category-2/product-apple
www.site.com/category-3/product-apple
But now when I am creating the second category called "product-apple" it says slug already exist.
How can I solve this problem ?
wordpress.org/plugins/woocommerce/

Related

Woocommerce filter products by author

I'm using Woocommerce API V2 and I need to get all product created by a single author.
When I go to:
https://my.url.com/wp-json/wc/v2/products
I get all products. That works fine. I also can filter by category with:
https://my.url.com/wp-json/wc/v2/products?category=43
That also works and returns only the products of the category with ID 43.
I would to get data like:
https://my.url.com/wp-json/wc/v2/products?category=43&author=1
How do I do the same, but with author of the product?
Thanks!

Multiple categories for a product shows wrong category in WooCommer

I've created a product that have multiple categories, but when I click on the product it shows the wrong category "Footcare" instead of "Handcare". What am I doing wrong?

Categories not shown in admin after adding woocommerce products via wp wc cli

After the following script is run
wp wc product create --name='b' --categories=32 --user=user
Output is printed:
Success: Created product 1370.
But no categories are shown in wp-admin/WooCommerce->Products page for the newly added product.
I have followed Find Product Category IDs to get category id.
Tried to use [32], ['32'] instead of 32. The result is the same. Category is not shown in wordpress admin.
How to fix it?
After opening issue on woocommerce github page and authorss reaction.
The solution is
wp wc product create --name='Product Name' --categories='[ { "id" : 21 } ]' --user=admin

Filter by custom field in WordPress admin list

Hoping that someone can help me with this rather frustrating issue:
I'm using Advanced Custom Fields for a custom post type called "customer_reviews" that has 2 custom fields: "cust_rating" (1-5) and "customer_tech" (ACF relationship field that returns 1 ID from another custom post type called "staff_members").
What i want to do is show 2 filter dropdowns in the admin list for "customer_reviews". One should say "Rating" and the other "Technician". The idea is to filter reviews by either x-star rating or technician, or both, meaning that for example, i'd like to show all 4 star reviews that are related to the technician "John Doe" and vice versa. I've researched how to add custom field filters to the admin list and here is my code so far: http://pastebin.com/5reZrEMk
The problem i keep running into is that when i filter by "Rating", i get the correct number of posts with that rating, but if i filter by "Technician" i get an empty list.

Linking tables in Drupal 7

I cant figure out how to link fields between 2 content-types in Drupal 7. For example...
I'm building an online shop using Drupal 7. There are several product categories and each category has its own page that displays all the products in that category plus a category description.
I store this data in two tables (content types). See below.
categories content-type:
category_name, description
----------------------------------------------
paintings, "A selection of paintings that we supply. Prices include ...."
ceramics, ....
jewellery, ....
.
products content-type:
name, category_name, price, ...
---------------------------------------------------
mona-lisa, paintings, £10,
necklace1, jewellery, £20,
necklace2, jewellery, £30,
.
The common field is 'category_name'. In the first table I define all the values for category_name and in the second table, each time I add a new product, I want to be able to pick one category to assign to the product. Does anyone know how to do this?
You can reuse fields between content types but you cant change the widget type (the 'categories' content-type needs free-text entry and the 'products' content-type needs a selector.
In Drupal 6 there seemed to be a 'node reference' field type which might be what I'm looking for but I cant figure out how to get this in Drupal7.
This module is still in progress but you can use references for that.

Resources