Repetive Text plug in für WordPress
Ein simples Plugin mit dem man Texte an verschiedenen Stellen auf der Website via Shortcode einbinden, ind zentral verwalten kann Einleitung Immer wieder kommt es
SEOM / Woocommerce / Woocommerce Snippets für die Functions.php die Dein Webshop braucht! Part 2
Hast Du Teil 1 meiner beliebtesten Woocommerce Snippets verpasst?
Hier entlang – seom.at/woocommerce-snippets-fuer-die-functions-php-die-dein-webshop-braucht
Diese Scripte sind von mir getestet, und laufen auf meinen Seiten. Jedoch garantiere ich nicht, dass sie auch auf Deiner Seite laufen.
Wenn Du eine Änderungun an der functions.php durchführen möchtest, sichere zuerst Deine Seite (Back Up).
Los gehts!
add_action( 'woocommerce_email_after_order_table', 'add_payment_method_to_admin_new_order', 15, 2 );
function add_payment_method_to_admin_new_order( $order, $is_admin_email ) {
if ( $is_admin_email ) {
echo '<p><strong>Payment Method:</strong> ' . $order->payment_method_title . '</p>';
}
}
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_upsells', 15 );
if ( ! function_exists( 'woocommerce_output_upsells' ) ) {
function woocommerce_output_upsells() {
woocommerce_upsell_display( 3,3 ); // Display 3 products in rows of 3
}
}
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('Choose and option', 'Select', $translated);
return $translated;
}
add_filter( 'woocommerce_product_categories_widget_args', 'woo_product_cat_widget_args' );
function woo_product_cat_widget_args( $cat_args ) {
$cat_args['exclude'] = array('16');
return $cat_args;
}
// Display Fields
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 2 );
//JS to add fields for new variations
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' );
//Save variation fields
add_action( 'woocommerce_process_product_meta_variable', 'variable_fields_process', 10, 1 );
function variable_fields( $loop, $variation_data ) { ?>
<tr>
<td>
<div>
<label></label>
<input type="text" size="5" name="my_custom_field[]" value=""/>
</div>
</td>
</tr>
<tr>
<td>
<div>
<label></label>
</div>
</td>
</tr>
<?php }
function variable_fields_process( $post_id ) {
if (isset( $_POST['variable_sku'] ) ) :
$variable_sku = $_POST['variable_sku'];
$variable_post_id = $_POST['variable_post_id'];
$variable_custom_field = $_POST['my_custom_field'];
for ( $i = 0; $i < sizeof( $variable_sku ); $i++ ) :
$variation_id = (int) $variable_post_id[$i];
if ( isset( $variable_custom_field[$i] ) ) {
update_post_meta( $variation_id, '_my_custom_field', stripslashes( $variable_custom_field[$i] ) );
}
endfor;
endif;
}
/**
* Change the add to cart text on single product pages
*/
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
function woo_custom_cart_button_text() {
global $woocommerce;
foreach($woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$_product = $values['data'];
if( get_the_ID() == $_product->id ) {
return __('Already in cart - Add Again?', 'woocommerce');
}
}
return __('Add to cart', 'woocommerce');
}
/**
* Change the add to cart text on product archives
*/
add_filter( 'add_to_cart_text', 'woo_archive_custom_cart_button_text' );
function woo_archive_custom_cart_button_text() {
global $woocommerce;
foreach($woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$_product = $values['data'];
if( get_the_ID() == $_product->id ) {
return __('Already in cart', 'woocommerce');
}
}
return __('Add to cart', 'woocommerce');
}
add_filter( 'woocommerce_subcategory_count_html', 'woo_remove_category_products_count' );
function woo_remove_category_products_count() {
return;
}
add_filter( 'woocommerce_product_tabs', 'woo_rename_tab', 98);
function woo_rename_tab($tabs) {
$tabs['description']['title'] = 'More info';
return $tabs;
}
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
global $woocommerce;
$minimum = 50;
if ( $woocommerce->cart->get_cart_total(); < $minimum ) {
$woocommerce->add_error( sprintf( 'You must have an order with a minimum of %s to place your order.' , $minimum ) );
}
}
add_filter('woocommerce_default_catalog_orderby', 'custom_default_catalog_orderby');
function custom_default_catalog_orderby() {
return 'date'; // Can also use title and price
}
add_filter ('add_to_cart_redirect', 'redirect_to_checkout');
function redirect_to_checkout() {
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url();
return $checkout_url;
}
function woo_extra_email_recipient($recipient, $object) {
$recipient = $recipient . ', your@email.com';
return $recipient;
}
add_filter( 'woocommerce_email_recipient_customer_completed_order', 'woo_extra_email_recipient', 10, 2);
Ein simples Plugin mit dem man Texte an verschiedenen Stellen auf der Website via Shortcode einbinden, ind zentral verwalten kann Einleitung Immer wieder kommt es
Mit der Create – Read – Update – Delete (kurz CRUD) php Anwendung setzt Du eine einfache Warenverwaltung auf. Inhalt Einleitung Ein simples online Warenbestands
Woocommerce oder Dein Theme macht nicht das was Du willst?Hier sind meine Lieblingsscripte für Woocmmerce! Inhalt Hast Du Teil 1 meiner beliebtesten Woocommerce Snippets verpasst?Hier
Thomas Wohlmuth Werbeagentur
Theodor-Körnerstrasse 51
8010 Graz
office[at]seom[punkt]at
ATU73734024