Skip to content

Instantly share code, notes, and snippets.

View EricBusch's full-sized avatar

Eric Busch EricBusch

  • Owen Sound, Ontario
View GitHub Profile
@EricBusch
EricBusch / mycode_import_gender_attribute-2.php
Last active September 28, 2022 16:00
Providing a Default Value if No Terms Found [dfrpswc][datafeedr]
<?php
/**
* Add the product's gender as an attribute.
*
* The attribute 'Gender' with a slug of 'gender' must already exist here: WordPress Admin Area > Products > Attributes
*
* @param array|string $value The current value of the $attribute for this $post.
* @param string $attribute The slug of the attribute. Examples: pa_color or pa_shoe-size
* @param array $post An array of post data including ID, post_title, post_status, etc...
@EricBusch
EricBusch / mycode_import_color_attribute-4.php
Last active September 28, 2022 15:59
Import Attribute From Multiple Fields with Preferred Terms [dfrpswc][datafeedr]
<?php
/**
* Add the product's color as an attribute.
*
* The attribute 'Color' with a slug of 'color' must already exist here: WordPress Admin Area > Products > Attributes
*
* @param array|string $value The current value of the $attribute for this $post.
* @param string $attribute The slug of the attribute. Examples: pa_color or pa_shoe-size
* @param array $post An array of post data including ID, post_title, post_status, etc...
@EricBusch
EricBusch / mycode_import_color_attribute-3.php
Last active September 28, 2022 15:58
Adding a Fallback Field When Attribute Variants Aren't Found [dfrpswc][datafeedr]
<?php
/**
* Add the product's color as an attribute.
*
* The attribute 'Color' with a slug of 'color' must already exist here: WordPress Admin Area > Products > Attributes
*
* @param array|string $value The current value of the $attribute for this $post.
* @param string $attribute The slug of the attribute. Examples: pa_color or pa_shoe-size
* @param array $post An array of post data including ID, post_title, post_status, etc...
@EricBusch
EricBusch / mycode_import_color_attribute-2.php
Last active September 28, 2022 15:58
Using Preferred Attribute Names and Attribute Name Variants [dfrpswc][datafeedr]
<?php
/**
* Add the product's color as an attribute.
*
* The attribute 'Color' with a slug of 'color' must already exist here: WordPress Admin Area > Products > Attributes
*
* @param array|string $value The current value of the $attribute for this $post.
* @param string $attribute The slug of the attribute. Examples: pa_color or pa_shoe-size
* @param array $post An array of post data including ID, post_title, post_status, etc...
@EricBusch
EricBusch / mycode_import_size_attribute-1.php
Last active September 28, 2022 15:56
Import Multiple Attributes from a Single Field [dfrpswc][datafeedr]
<?php
/**
* Add the product's size as an attribute.
*
* The attribute "Size" with a slug of "size" must already exist here: WordPress Admin Area > Products > Attributes
*
* @param array|string $value The current value of the $attribute for this $post.
* @param string $attribute The slug of the attribute. Examples: pa_color or pa_shoe-size
* @param array $post An array of post data including ID, post_title, post_status, etc...
@EricBusch
EricBusch / mycode_import_gender_attribute-1.php
Last active September 28, 2022 15:55
Import Attribute from Multiple Fields [dfrpswc][datafeedr]
<?php
/**
* Add the product's gender as an attribute.
*
* The attribute "Gender" with a slug of "gender" must already exist here: WordPress Admin Area > Products > Attributes
*
* @param array|string $value The current value of the $attribute for this $post.
* @param string $attribute The slug of the attribute. Examples: pa_color or pa_shoe-size
* @param array $post An array of post data including ID, post_title, post_status, etc...
@EricBusch
EricBusch / mycode_import_color_attribute-1.php
Last active September 28, 2022 15:55
Import Attribute from a Specific Field [dfrpswc]
<?php
/**
* Add the product's color as an attribute.
*
* The attribute "Color" with a slug of "color" must already exist here: WordPress Admin Area > Products > Attributes
*
* @param array|string $value The current value of the $attribute for this $post.
* @param string $attribute The slug of the attribute. Examples: pa_color or pa_shoe-size
* @param array $post An array of post data including ID, post_title, post_status, etc...
@EricBusch
EricBusch / dfrpswc-attribute-importer-examples.php
Last active June 20, 2022 09:00
Examples of using the Dfrpswc_Attribute_Importer() class [dfrpswc][datafeedr]
<?php
/**
* Add the product's Size as an attribute.
*
* The attribute "Size" with a slug of "size" must already exist here: WordPress Admin Area > Products > Attributes
*
* @param array|string $value The current value of the $attribute for this $post.
* @param string $attribute The slug of the attribute. Examples: pa_color or pa_shoe-size
* @param array $post An array of post data including ID, post_title, post_status, etc...
@EricBusch
EricBusch / fix-curl-error-60.php
Created July 18, 2018 16:08
Fix "cURL error 60: SSL certificate problem: unable to get local issuer certificate" errors during product image import.
<?php
/**
* Disable SSL verification during the image import process.
*
* This helps to overcome the "cURL error 60: SSL certificate problem: unable to get local issuer certificate" error.
*
* @param array $args
* @param Datafeedr_Image_Importer $image_importer
*
@EricBusch
EricBusch / add_size_attribute-05.php
Last active September 28, 2022 16:26
Automatically add the product's size as a size attribute from multiple fields with defaults and normalize the size name. [datafeedr][dfrpswc]
<?php
/**
* Add the product's size as a size attribute for this product.
*
* The attribute "Size" with a slug of "size"
* must already exist here:
* WordPress Admin Area > Products > Attributes.
*
* @param array|string $value The current value of the $attribute for this $post.