In WooCommerce every product has a field 'total_sales'. However, I have two different customers:
Retail customers: guest checkout or customer role 'customer'.
Wholesale customers: user role 'wholesale_customer'.
I would like to add two extra fields to every products:
total_sales_retail
total_sales_wholesale
I can manage to add those fields to the products, but how to get the data in there, if this is possible?
Related
Query to get Attributes based on Product Category selected in WooCommerce?
Just want to create an endpoint for the one answered by Veer
i have big Challenge and i want to know, if it’s possible.
I need a Solution to create Company Profiles with Fields about the Adress, ZipCode, City etc… This Company can create a user (employee).
This User can invite another User(employee) to this Company.
If he do that, the Company profile Fields must be Synced with the Employee Profile Field Data.
The Employee Fild Data about the Company must be the Same as tthe Company.
My Acutally Setup:
User Creation: BuddyPress
Company Profiles: With BuddyPress Groups
To create a Group (Company) and a User Registration i use Buddyforms.
Buddyforms Create a new Post in a Custom Post Type with the Company Information an attach this Post to the Group.
Maybe is it possible, all BP Group Members will be synced with this custom fields?
Or maybe i need another Solution?
Regards
I am building a PHP $_SESSION array as a user goes thru the shopping process, collecting data about their actions. I want to insert the current cart ID or order ID into the session array so I can tie the two together.
How do I get the cart ID or order iD before checkout, like from inside of woocommerce_ajax_add_to_cart() or something, so as soon as the first product is added to the cart, it also adds the cart ID to the session?
TL;DR how do I get the woocommerce cart ID after the first product is added, and use that to get the final order ID after payment?
where does Wish List for WooCommerce store in database the relation between user and product?
what is the table name?
How can I create a client search filter on the woocommerce order page?
Example:
Search customer by zip code
Or
Find customer by phone number
To list customer orders
The WooCommerce Order Admin allows you to search for ordres by the following fields:
order key
billing first name
billing last name
billing company
billing address 1
billing city
billing postcode
billing country
billing state
billing email
billing phone
order items
If you need to search by another order field you could add this a functionality plugin or your themes functions.php file:
add_filter( 'woocommerce_shop_order_search_fields', 'woocommerce_shop_order_search_order_total' );
function woocommerce_shop_order_search_order_total( $search_fields ) {
$search_fields[] = '_order_total';
return $search_fields;
}
With that simple snippet active you can now search by order total. Using this technique you can even search by custom post meta that you may be adding to the order records.
credit to SkyVerge for their docs on this