Skip to content

Instantly share code, notes, and snippets.

View tribulant's full-sized avatar

Tribulant tribulant

View GitHub Profile
@tribulant
tribulant / gist:05e4e0ef4ca0d99e82cc
Last active August 29, 2015 14:04
checkout_extensions_list
<?php
function extensions_list($extensions = array()) {
$extensions['guestcheckout'] = array(
'name' => "Guest Checkout",
'link' => "http://domain.com",
'image' => plugins_url() . '/mypmethod/images/icon.png',
'description' => __("My Payment Method for the Shopping Cart plugin.", 'mypmethod'),
'slug' => 'mypmethod',
@tribulant
tribulant / gist:f6333367fc3591cc5eb0
Created July 29, 2014 14:33
Checkout: Filter - checkout_extensions_list usage
<?php
add_filter('checkout_extensions_list', 'extensions_list', 10, 1);
?>
@tribulant
tribulant / gist:2962851164dcd6aa097c
Created July 29, 2014 14:57
Checkout: Action - checkout_admin_extensions_settings_saved usage
<?php
add_action('checkout_admin_extensions_settings_saved', 'extensions_settings_saved', 10, 1);
?>
@tribulant
tribulant / checkout_admin_extensions_settings_saved.php
Last active August 29, 2015 14:04
Checkout: Action - checkout_admin_extensions_settings_saved example
<?php
function extensions_settings_saved($data = null) {
// Do something with the $_POST data as needed
// print_r($data);
}
add_action('checkout_admin_extensions_settings_saved', 'extensions_settings_saved', 10, 1);
?>
@tribulant
tribulant / gist:bc90399ce278aa7efdfa
Created July 30, 2014 10:10
Checkout: Function - wpco_cart_url()
<?php
$cart_url = wpco_cart_url();
?>
@tribulant
tribulant / gist:ec74b7969db452038e0d
Created August 1, 2014 09:47
Checkout: Action - checkout_admin_supplier_saved Usage
<?php
add_action('checkout_admin_supplier_saved', 'supplier_saved', 10, 2);
?>
@tribulant
tribulant / gist:5b281b99fe3eb6004773
Created August 1, 2014 09:50
Checkout: Action - checkout_admin_supplier_saved Example
<?php
function supplier_saved($insertid = null, $data = null) {
// Do something with $insertid or $data
global $wpcoDb, $Supplier;
$wpcoDb -> model = $Supplier -> model;
$supplier = $wpcoDb -> find(array('id' => $insertid));
}
@tribulant
tribulant / gist:56a20070b83a0758650a
Created August 1, 2014 10:17
Checkout: Action - checkout_order_finished Example
<?php
function order_finished($order_id = null, $pmethod = null, $paid = null) {
//an order was finished, now we can do something with it
if ($order = wpco_get_order($order_id)) {
//we now have all the data of the order to work with
//print_r($order);
}
}
@tribulant
tribulant / gist:e3074e475a137ac53096
Created August 1, 2014 12:29
Checkout: Filter - checkout_image_attributes Example
<?php
// $attributes = apply_filters('checkout_image_attributes', false, $image, $width, $height, $class);
function attributes($attributes = array(), $image = null, $width = null, $height = null, $class = null) {
$attributes['data-foo'] = "foo-value"; // <img data-foo="foo-value" />
$attributes['rel'] = "overlaybox"; // <img rel="overlaybox" />
}
add_filter('checkout_image_attributes', 'attributes', 10, 5);
@tribulant
tribulant / gist:6ad49da21ea9d153ab43
Created August 5, 2014 12:54
checkout_image_attributes
<?php
function image_attributes($attributes, $image, $width, $height, $class) {
$attributes['data-zoom-image'] = $attributes['src'];
return $attributes;
}
add_filter('checkout_image_attributes', 'image_attributes', 10, 5);
?>