Hi @jefimijaorg, do you want to set shipping fee from seller’s location to customer’s ?
I apologize for losing English. Yes, I want the seller to determine the price of shipping. The price would be in the user’s meta. In addition, I need the code for the total price of the vendors in the basket.Here’s the picture I want to do. There would be a special way of delivery, so I know how to do it. It’s only important for me to find the seller’s id https://sr-rs.imgbb.com/
-
Овај одговор је промењен 8 years, 2 months раније од стране
jefimijaorg.
-
Овај одговор је промењен 8 years, 2 months раније од стране
jefimijaorg.
Hi @jefimijaorg, do you want to fetch the vendor_id from the order? I am afraid the link you have shared, doesn’t have any image with it.
@jefimijaorg, you have to fetch the author_id from the product_id, the get the vendor_id from that author_id.
That it’s ok, but where can I put that code? What’s the hook for something like that where to change? How do I get the product ID in the cart I know, but I do not know how to display it where I marked it
Hi @jefimijaorg you have to add these code in the function.php of the current active theme. Please look into this forums, they will be able to help you out further on this: https://stackoverflow.com/questions/27385920/woocommerce-get-current-product-id and this document: https://docs.woocommerce.com/wc-apidocs/hook-docs.html
Ocito se ne razumemo. Ja pisem prevod preko googl-a pa je moguce da je zato.Izvucem ja id od vendora koji su u korpi. To je ovaj kod global $woocommerce;
// For all Woocommerce versions
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ){
$post_obj = get_post( $cart_item[‘product_id’] ); // The WP_Post object
$post_author[] = $post_obj->post_author; // <=== The post author ID
}
$states = array_unique($post_author);
foreach ($states as $vendor)
echo $vendor;
i kad ubacim da mi menja cenu transporta vuce samo za prvog ali ne i za sve koji su u korpi. Da li je sad jasnije sta zelim da postignem?
We obviously do not understand. I can not translate it through googl so it is possible that is why. I’m the id of the vendors who are in the basket. This is this code in
-`global $woocommerce;
// For all Woocommerce versions
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ){
$post_obj = get_post( $cart_item[‘product_id’] ); // The WP_Post object
$post_author[] = $post_obj->post_author; // <=== The post author ID
}
$product_vendor = array_unique($post_author);
foreach ($product_vendor as $vendor)
{
echo $vendor;
}`
and when I add that the price of the tug cargo is only for the first but not for everyone in the cargo. Now, is there any clearer I want to achieve?
-
Овај одговор је промењен 8 years, 1 month раније од стране
jefimijaorg.