Manually create an order with a product ID woocommerce

I think you can use the following: $order->update_meta_data( ‘YOUR_META_KEY_HERE’, $note ); Remember to replace YOUR_META_KEY_HERE with your preferred key, Complete code: add_action( ‘gform_after_submission_56’, ‘post_to_third_party’, 10, 2 ); function post_to_third_party( $entry, $form ) { global $woocommerce; // use this to find out $entry output var_dump($entry); // Make sure to add hidden field somewhere in the form … Read more

Check if product variation image is from the variation itself or from the parent

Solution: If you check for the image ID with parameter $context=”edit”, you will only get a returned ID if the image is set directly to the variation. The code looks like this: $image_id = $variation->get_image_id(‘edit’); if ($image_id){ //Only if there is an image to the variation itself echo $image_id; } Ref: https://docs.woocommerce.com/wc-apidocs/source-class-WC_Product.html#662-671

woocommerce ad custom button with custom link after add to cart for every product

As you can see in the wpse_add_custom_link_output callback function this echo the $html variable. So you can simply replace the following line $html=”<a href=””.$external_link.'” class=”custom-button-class” target=”_blank” title=”‘.__(‘External product link’,’woocommerce’).'”>’.$external_link.'</a>’; With something like $html=”<button type=”button”>BUY NOW</button>”;

WooCommerce Review Author Hook on Review Submission

Found it! Go to wp-includes > comment-templates.php. Edit around line 2560: else ( ! is_user_logged_in() ) { to else { Then in my plugin .php file or your Theme ‘function.php’, add: function modify_author($commentdata) { $commentdata[‘comment_author’] = $_POST[‘author’]; // You should sanitize this. return $commentdata; } add_filter(‘preprocess_comment’, ‘modify_author’); I know it’s bad idea to modify comment-templates.php, … Read more