Functions
Functions
php
/**
* Storefront engine room
*
* @package storefront
*/
/**
* Assign the Storefront version to a var
*/
$theme = wp_get_theme( 'storefront' );
$storefront_version = $theme['Version'];
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) ) {
$content_width = 980; /* pixels */
}
/**
* Initialize all the things.
*/
'main' => require 'inc/class-storefront.php',
'customizer' => require 'inc/customizer/class-storefront-customizer.php',
);
require 'inc/storefront-functions.php';
require 'inc/storefront-template-hooks.php';
require 'inc/storefront-template-functions.php';
require 'inc/wordpress-shims.php';
if ( class_exists( 'Jetpack' ) ) {
$storefront->jetpack = require 'inc/jetpack/class-storefront-jetpack.php';
}
if ( storefront_is_woocommerce_activated() ) {
$storefront->woocommerce = require 'inc/woocommerce/class-
storefront-woocommerce.php';
$storefront->woocommerce_customizer = require 'inc/woocommerce/class-
storefront-woocommerce-customizer.php';
require 'inc/woocommerce/class-storefront-woocommerce-adjacent-products.php';
require 'inc/woocommerce/storefront-woocommerce-template-hooks.php';
require 'inc/woocommerce/storefront-woocommerce-template-functions.php';
require 'inc/woocommerce/storefront-woocommerce-functions.php';
}
if ( is_admin() ) {
$storefront->admin = require 'inc/admin/class-storefront-admin.php';
require 'inc/admin/class-storefront-plugin-install.php';
}
/**
* NUX
* Only load if wp version is 4.7.3 or above because of this issue;
* https://core.trac.wordpress.org/ticket/39610?cversion=1&cnum_hist=2
*/
if ( version_compare( get_bloginfo( 'version' ), '4.7.3', '>=' ) && ( is_admin() ||
is_customize_preview() ) ) {
require 'inc/nux/class-storefront-nux-admin.php';
require 'inc/nux/class-storefront-nux-guided-tour.php';
// ******************************************
// Iron Bank of Braavos - Payment Script v1.0
// Master code
// Creates the Payment Details when an order is placed on the website or through
API calls
add_action('woocommerce_new_order', function ($order_id) {
$order = wc_get_order( $order_id ); // Get $order object from order_id
$ord_id = $order->get_id();
// Changes the Slave order status to Paid when it's changed from onhold to paid on
the Master
add_action('woocommerce_payment_complete', function ($order_id) {
// Send an email to Admin to let him know the order was paid
$order = wc_get_order( $order_id );
if( ! $order->has_status( 'processing' ) ) return;
$wc_email = WC()->mailer()->get_emails()['WC_Email_New_Order'];
// Customizing Email
// Change Subject
$wc_email->settings['subject'] = __('{site_title} – Order Paid ({order_number})');
// Change Heading
$wc_email->settings['heading'] = __('Cust Paid Order');
$wc_email->settings['recipient'] .= ',info@dentalwhite.pt';
$wc_email->trigger( $order_id );
}, 11, 1);
// Iron Bank of Braavos - Payment Script v1.0
// ******************************************