Skip to content

Instantly share code, notes, and snippets.

View Auke1810's full-sized avatar

Auke Jongbloed Auke1810

View GitHub Profile
@Auke1810
Auke1810 / Alter feed items
Last active November 18, 2026 08:12
Example how to use the wppfm_feed_item_value filter for woocommerce product feed manager
<?php
function alter_feed_item( $attributes, $feed_id, $product_id ) {
// The $attributes variable is an array that contains all the product data that goes into the feed. Each item
// can be accessed by it's feed key. So if in the feed file an item has a key like 'description', you
// can access that specific item by $attributes['description'].
// The $feed_id (string) makes it possible to only edit a specific feed. You can find the id of a feed in the
// url of the Feed Editor, right after id=.
// The $product_id (string) makes it possible to select a specific product id that you want to filter.
@mikejolley
mikejolley / functions.php
Last active May 17, 2021 13:51
WooCommerce - Split shipping class items into a new package and limit shipping methods
/**
* This function loops over cart items, and moves any item with shipping class 'special-class' into a new package.
* The new package in this example only takes flat rate shipping.
*/
function split_special_shipping_class_items( $packages ) {
$found_item = false;
$special_class = 'special-class'; // edit this with the slug of your shippig class
$new_package = current( $packages );
$new_package['contents'] = array();
$new_package['contents_cost'] = 0;
@pullmonkey
pullmonkey / gist:783562
Created January 17, 2011 21:54
Comprehensive PHP VIN Decoder using VIN API
<?
// VIN API decoder for PHP 4.x+
define('ELEMENT_CONTENT_ONLY', true);
define('ELEMENT_PRESERVE_TAGS', false);
function getXML($vin) {
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, 'http://vinapi.skizmo.com/vins/'. $vin.'.xml');
curl_setopt ($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', 'X-VinApiKey: #YOURAPIKEYGOESHERE#')); //use your API key here