custom-fields

Woocommerce custom fields won't update when I leave them empty and still displays empty fields

旧街凉风 提交于 2019-12-06 08:24:26
I added a custom field to a single product page for woocommerce in order to show ISBN number for the books I sell. I found a nice guide and managed to add everything as I want. However when I empty the custom field for ISBN it won't go empty on the site. I have the following code in the functions.php // Display Fields add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' ); // Save Fields add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' ); function woo_add_custom_general_fields() { global $woocommerce, $post; echo '

Jira: How to obtain the previous value for a custom field in a custom IssueEventListener

吃可爱长大的小学妹 提交于 2019-12-06 06:09:54
问题 So how does one obtain the previous value of a custom field in a Jira IssueEventListener? I am writing a custom handler for the issueUpdated(IssueEvent) event and I would like to alter the handler's behavior if a certain custom field has changed. To detect the type of change I would like to compare the previous and current values. (I'm am not asking about how to obtain its current value - I know how to get that from the related Issue) I am developing against Jira 4.0.2 on Windows. Is the best

Display product custom fields as order items in Woocommerce 3

强颜欢笑 提交于 2019-12-06 01:04:41
In Woocommerce, I use custom fields to calculate the price of a product, based on this code - Set a calculated price for variable products in the WooCommerce . Thanks for the help LoicTheAztec. // Add a custom field before single add to cart add_action( 'woocommerce_before_add_to_cart_button', 'custom_product_price_field', 5 ); function custom_product_price_field(){ echo '<div class="custom-text text"> <h3>Rental</h3> <label>Start Date:</label> <input type="date" name="rental_date" value="" class="rental_date" /> <label>Period Rental:</label> <select name="custom_price" class="custom_price">

Displaying custom product data in Order items view

非 Y 不嫁゛ 提交于 2019-12-05 22:49:46
I have a issue with add to cart. I have a product with different custom conditions to choose. When the customer selects a specific choice. it adds to the cart. When the customer choice another choice and adds. Its shows as a second item in the cart. Which is okay. But after the payment, the order shows the both the custom option under the item 1 and item 2 without the custom data. so I was thinking instead of showing the same product as different items. I want to update the product custom data, so it will always show as single item. (Note: I have enabled the option "Sold Individually" from the

Add / Update Custom Fields After Select Pictures in Media Window (Wordpress)

廉价感情. 提交于 2019-12-05 15:24:52
I have a question about wordpress, I just added a button called Add Slider in Add/Edit Post Page. here's my code in my function.php : //Add button to create slider add_action('media_buttons','add_my_media_button',15); function add_my_media_button(){ echo '<a href="#" id="insert-my-media" class="button">Add Slider</a>'; } function include_media_button_js_file(){ wp_enqueue_script('media_button',get_bloginfo('template_directory').'/js/media_button.js',array('jquery'),'1.0',true); } add_action('wp_enqueue_media','include_media_button_js_file'); and this my media_button.js code jQuery(function($){

Set a calculated price for variable products in the WooCommerce

时间秒杀一切 提交于 2019-12-05 12:14:10
In Woocommerce, I use custom fields to calculate the price of a product, based on this code - Add custom fields to custom product calculated price in Woocommerce . Thanks for the help LoicTheAztec. // Add a custom field before single add to cart add_action( 'woocommerce_before_add_to_cart_button', 'custom_product_price_field', 5 ); function custom_product_price_field(){ echo '<div class="custom-text text"> <h3>Rental</h3> <label>Start Date:</label> <input type="date" name="rental_date" value="" class="rental_date" /> <label>Period Rental:</label> <select name="custom_price" class="custom_price

Woocommerce get Product id using product SKU

橙三吉。 提交于 2019-12-05 03:01:59
I'm working on a separate templates page, which page gets woocommece product sku using custom field of wordpress post. i need to get product id of that sku for create woocommece object and do further things, here is my code. global $woocommerce; //this return sku (custom field on a wordpress post) $sku=get_field( "product_sku" ); if($sku!=''){ //need to create object, but using sku cannot create a object, $product = new WC_Product($sku); echo $product->get_price_html(); } is there way to get product id before create object, then i can pass the product id to WC_Product class constructor and

Add a custom field in Woocommerce Edit Account page

最后都变了- 提交于 2019-12-05 02:52:52
问题 I have custom checkout fields favorite_color that users can fill in during checkout (not required) ,imilar to other default checkout fields... In My Account section in "Edit Account", I Would like to add favorite_color custom field to allow customer editing this field value. For that I have edited the template myaccount/form-edit-account.php by copying and editing an original line of code in it: <p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first"> <label for=

PHP DOMDocument : How to parse xml/rss Tags with CUSTOM field names?

倖福魔咒の 提交于 2019-12-04 20:15:38
I have the below RSS to parse, something like: <?xml version="1.0" encoding="utf-8"?> <rss xmlns:x-wr="http://www.w3.org/2002/12/cal/prod/Apple_Comp_628d9d8459c556fa#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:x-example="http://www.example.com/rss/x-example" xmlns:x-microsoft="http://schemas.microsoft.com/x-microsoft" xmlns:xCal="urn:ietf:params:xml:ns:xcal" version="2.0"> <channel> <item> <title>About Apples</title> <author>David K. Lowie</title> <x-trumba:customfield name="description">This is the description about apples</xCal

WooCommerce REST API Custom Fields

浪子不回头ぞ 提交于 2019-12-04 19:34:28
问题 Is it possible to access custom fields for orders, products, customers via WooCommerce REST API? If not natively, then what plugins or workarounds or hacks are out there that work? Thanks! 回答1: Answering my own question: It is possible using the following: (using v3 legacy API) To send custom fields back to the server: (For Orders) { "order_meta": { "key": "value" } } To retrieve custom fields from server use this filter with your end point: http://www.example.com/wc-api/v3/orders?filter[meta