Plugin Directory

Changeset 2291765


Ignore:
Timestamp:
04/25/2020 09:22:43 PM (6 years ago)
Author:
kreamweb
Message:

version 1.0.9

Location:
product-gtin-ean-upc-isbn-for-woocommerce
Files:
18 added
3 edited

Legend:

Unmodified
Added
Removed
  • product-gtin-ean-upc-isbn-for-woocommerce/trunk/includes/class.product-gtin-wc.php

    r2222694 r2291765  
    133133
    134134        //Structured data
    135         add_filter( 'woocommerce_structured_data_product', array( $this,'wpm_structured_data_product') );
     135        add_filter( 'woocommerce_structured_data_product', array( $this,'wpm_structured_data_product'), 10, 2 );
    136136
    137137    }
     
    145145     * @return mixed
    146146     */
    147     public function wpm_structured_data_product( $data ) {
    148         global $product;
    149 
     147    public function wpm_structured_data_product( $data, $product ) {
    150148        $property          = apply_filters( 'wpm_structured_data_product_property', get_option( 'wpm_pgw_structured_data_field', 'gtin' ), $product );
    151 
    152149        $data[ $property ] = $product->get_meta( '_wpm_gtin_code' );
    153 
    154150        return $data;
    155151    }
  • product-gtin-ean-upc-isbn-for-woocommerce/trunk/product-gtin-ean-upc-isbn-for-woocommerce.php

    r2222694 r2291765  
    44 * Author URI: https://emanuelacastorina.com/
    55 * Description: Add a Global Trade Item Number (EAN, UPC, ISBN, JAN, ITF-14) field to WooCommerce
    6  * Version: 1.0.8
     6 * Version: 1.0.9
    77 * Author: Emanuela Castorina
    88 * Text Domain: product-gtin-ean-upc-isbn-for-woocommerce
    99 * Domain Path: /languages
    10  * WC tested up to: 3.9
     10 * WC tested up to: 4.1
    1111 * WC requires at least: 3.0
    1212 */
     
    2121 */
    2222if ( ! defined( 'WPM_PRODUCT_GTIN_WC_VERSION' ) ) {
    23     define( 'WPM_PRODUCT_GTIN_WC_VERSION', '1.0.8' );
     23    define( 'WPM_PRODUCT_GTIN_WC_VERSION', '1.0.9' );
    2424}
    2525
  • product-gtin-ean-upc-isbn-for-woocommerce/trunk/readme.txt

    r2222694 r2291765  
    6666If your product is variable, you can set a GTIN code for each variation; you can fill out the GTIN field that you'll find inside the variation detail panel.
    6767
     68= Where is stored the GTIN code ? =
     69The GTIN code is a private custom field of product with *meta_key* `_wpm_gtin_code`
     70If you have the product object you can get the GTIN code in this way:
     71
     72`$gtin = $product->get_meta('_wpm_gtin_code');`
     73
    6874= How can use the shortcode to show the GTIN code where I want? =
    6975The shortcode to show the GTIN code is `[wpm_product_gtin]` you can use these attributes:
     
    8086"Override GTIN Code Label"
    8187
     88= How set GTIN code with WooCommerce REST API? =
     89When you create or update a product via REST API it is possible set or update the custom meta:
     90
     91  `"meta_data": [
     92    {
     93      "key": "_wpm_gtin_code",
     94      "value":"123798123987132"
     95    }
     96  ]`
    8297
    8398== Screenshots ==
     
    99114
    100115== Changelog ==
     116= 1.0.9 - Released: 25 April, 2020 =
     117*  New: Support for WooCommerce 4.1
     118
    101119= 1.0.8 - Released: Jan 6, 2020 =
    102120* Fix: Fixed the PHP warning
Note: See TracChangeset for help on using the changeset viewer.