shamoonalitee
Forum Replies Created
-
@rashed Thankyou very much! it solved my issue. Works like a charm! ??
@rashed Ripon thankyou very much for the help!
But, can you please confirm, i only have one dokan folder that is in wp-content/plugins/dokan-lite. Are you referring to this folder? because i dont see any other dokan folder in my wordpress directory.
Note: I’m working on localhost.
Hey @roshni07
It works like a charm now i never though it could be this. Thanks a lot you are a life saver!
??
@lorro Oh thanks! didn’t about this…
Thanks guys i finally got the code working… going to post the code here so that someone else with the same query can view it.
add_action( 'get_header', 'change_and_save_product_price', 10, 2 ); function change_and_save_product_price() { if ( get_post_type() === "product" ){ // or use: is_product() // Regular Price $regular_price = 400; // Sale Price (If you want to add any) $sale_price = 336; // Set the product ID of the product you want to change the price of $productID = 167; // Get product $product = wc_get_product($productID); // Set regular price $product->set_regular_price( $regular_price ); // If your product has a Sale price if( $sale_price ) { $product->set_sale_price( $sale_price ); $new_price = $sale_price; } else { $new_price = $regular_price; } // Set new price $product->set_price( $new_price ); // Save to database (Note: You might want to clear cache of your page and then reload, if it still doesn't show up go to the product page and check there.) $product->save(); } } do_action('get_header');
- This reply was modified 4 years, 10 months ago by shamoonalitee.
@lorro Thanks man! i’ll give it a try!
@lorro Thanks! but How can I use these functions for just a single product, that it updates its price not only on display but in the database as well? Is there a way of doing that or am I asking for something that cannot be done?
I tried adding this code
function return_custom_price($price, $product) { global $post, $blog_id; $product = wc_get_product( '$post_id' ); $post_id = $post->ID; $wc_product_id = 168; if($post_id == $wc_product_id) { $price = 77; } return $price; } add_filter('woocommerce_get_price', 'return_custom_price', 10, 2);
It does change the displayed price of the product, but the actual price in the database and the woocommerce dashboard remains the same.
- This reply was modified 4 years, 10 months ago by shamoonalitee.
- This reply was modified 4 years, 10 months ago by shamoonalitee.
@riaanknoetze Yes I’ve seen that Plugin, its not really what i was looking for my project is a little different. Anyways, thank you so much for the links!
Forum: Plugins
In reply to: [LoginWP (Formerly Peter's Login Redirect)] Redirect doesn’t work at allThat would be very helpful! The plugin is a life saver otherwise.
Forum: Plugins
In reply to: [LoginWP (Formerly Peter's Login Redirect)] Redirect doesn’t work at allHey! So i think i’m having the same issue.. however the plugin seems to be working fine when i logout, it redirects me to the assigned page but doesn’t redirect when logging in..
One solution i found out is that when i login through example.com/wp-admin/, it works fine but when i try to login through WooCommerce login form or any other form plugins, it doesn’t work..
Hope this helped.. And if you found a better solution please let me know as well.
- This reply was modified 4 years, 11 months ago by shamoonalitee.