1. Onderwerpen
  2. Codeknipsels

Codeknipsels

Dit is een voor ontwikkelaars document. Als u niet bekend bent met code / templates en het oplossen van mogelijke conflicten, neem dan contact op met een ontwikkelaar die bekend is met FooSales en / of WooCommerce. Deze snippets worden geleverd als een hoffelijkheid en zijn bedoeld als een startpunt om eventuele specifieke aanpassing behoeften te helpen. We zijn niet in staat om ondersteuning te bieden voor aanpassingen onder onze Servicevoorwaarden.

Vastleggen Square kosten bij het voltooien van een bestelling #

If you’re using a third-party export plugin to export your orders and you’re processing payments with Square, you might want to include the fees that Square deducts from the payment in your sales export. This help document previously contained a code snippet that captured Square processing fees as meta data upon order completion. This, however, didn’t support split payments and since the structure of plugin 1.40.0+ has been completely overhauled, the code snippet will no longer function. The functionality contained within the code snippet has been added to the plugin’s core functionality which also supports split payments and various order submit statuses in plugin version 1.40.2

Let op that if you previously added the code snippet to your functions.php file, you must remove it to prevent critical errors when submitting orders through FooSales.

You can read more about how Square fees are captured in our Square Payment Integration help document.

De bestelnotitie van FooSales toevoegen aan de WooCommerce admin e-mails #

Voeg het volgende codefragment toe aan de functies.php bestand als je wilt dat de "Bestelnotitie" die je hebt toegevoegd aan de bestelling in FooSales wordt weergegeven in de WooCommerce admin e-mails.

add_action( 'woocommerce_email_order_meta', 'woo_add_order_notes_to_email', 10, 4 );

function woo_add_order_notes_to_email($order, $sent_to_admin, $plain_text, $email) {

	if ( isset($post->ID) )
		$id = $post->ID;
	else
		$id = $order->ID;


	if ($sent_to_admin && 'foosales_app' === get_post_meta($id, '_foosales_order_source', true)) {
		$args = array(
			'order_id' 	=> $id,
			'type' 		=> ''
		);
		
		$notes = wc_get_order_notes( $args );
		
		echo '<h2>' . __( 'Bestelnotities', 'woocommerce' ) . '</h2>';

		echo '<ul class="order_notes">';

		if ( $notes ) {
				?&gt;
				<li>
					<div class="note_content">
						<?php echo wpautop( wptexturize( wp_kses_post( $notes[count($notes)-1]->content ) ) ); ?>
					</div>
				</li>
				<?php
		} else {
			echo '<li>' . __( "Er zijn nog geen notities voor deze bestelling.", "woocommerce" ) . '</li>';
		}

		echo '</ul>';
	}
}

Artikelen