ariban99
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Selling meats via WooCommercewe do this on our website, here is the snippet code below however you also need to install the plugin advance custom fields create a new field named price per lb, in there field label is produce price type. field name is product_price_type (this field name must match as its in the code below), require NO, field type select, choices Per lb, allow null YES, the rest leave as is.
rules post taxonomy is qual to simple and also another one is equal to variable (simple or variable products) save!
then in each product you will see a NEW field to select PER LB, if you select that in the product, that item will be by the lb that you set in shipping weight.add_filter( 'woocommerce_get_price_html', 'wb_change_product_html', 10, 2 ); // Adding a custom field to the price markup function wb_change_product_html( $price, $product ) { //$wb_price_type = get_field('product_price_type'); //~ print "<pre>".print_r($product, true)."</pre>"; //~ print "<pre>".print_r($product->get_price(), true)."</pre>"; $wb_price_type = get_post_meta( $product->get_id(), 'product_price_type', true); if($wb_price_type) { $price_html = '<span class="amount">' . $price . '<span class="woocommerce-Price-suffix"> ' . $wb_price_type . '</span></span>'; } else { $price_html = '<span class="amount">' . $price . '</span>'; } return $price_html; } add_filter( 'woocommerce_cart_item_price', 'wb_change_product_price_cart', 10, 3 ); // Adding a custom field to the price in the cart function wb_change_product_price_cart( $price, $cart_item, $cart_item_key ) { $product_variation = $cart_item['data']->get_data(); $wb_price_type = get_post_meta( $cart_item['product_id'], 'product_price_type', true ); if ($wb_price_type) { //~ $price = $price . ' ' . $wb_price_type; $price = '<span class="amount_per_lb"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">' . get_woocommerce_currency_symbol() . '</span>' . $product_variation['price'] . '</span> ' . $wb_price_type. ' </span><span class="amount_per_pack">(' . $price . ' estimated)</span>'; } else { $price = $price; } return $price; } add_filter( 'woocommerce_checkout_cart_item_quantity', 'wb_checkout_review', 10, 3 ); // Adding a custom field to the price in the checkout items function wb_checkout_review ( $quantity, $cart_item, $cart_item_key ) { $product_variation = $cart_item['data']->get_data(); $wb_price_type = get_post_meta( $cart_item['product_id'], 'product_price_type', true); if ( $wb_price_type ) { $cart_item = ' ' . get_woocommerce_currency_symbol() . $product_variation['price'] . ' '. $wb_price_type . ' (' . get_woocommerce_currency_symbol() . $cart_item['data']->get_price() . ' estimated) ' . sprintf( '× %s ', $cart_item['quantity'] ) ; } else { $cart_item = ' ' . sprintf( '× %s', $cart_item['quantity'] ) . ''; } return $cart_item; } add_action( 'woocommerce_before_calculate_totals', 'modify_cart_price', 20000, 1); function modify_cart_price( $cart_obj ) { if ( is_admin() && ! defined( 'DOING_AJAX' ) || ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 )) return; foreach ( $cart_obj->get_cart() as $cart_item ) { $var = get_post_meta( $cart_item['product_id'], '', true); if($var['product_price_type'][0]){ $cart_item['data']->set_price( $cart_item['data']->get_price() * $cart_item['data']->get_weight() ); } } } add_action( 'woocommerce_single_product_summary', 'set_var_on_single_product_page', 1 ); function set_var_on_single_product_page() { global $product; $wb_price_type = get_post_meta( $product->get_id(), 'product_price_type', true); //~ print "<pre>".print_r($wb_price_type, true)."</pre>"; if ($wb_price_type){ print "<script> var per_lb = true;</script>"; } else{ print "<script> var per_lb = false;</script>"; } } add_action( 'woocommerce_single_product_summary', 'set_sum_price_on_single_product_page', 11 ); function set_sum_price_on_single_product_page() { global $product; $wb_price_type = get_post_meta( $product->get_id(), 'product_price_type', true); if ($wb_price_type && !$product->has_child()){ print "<span class='summ_price'><span class='amount'><span class='woocommerce-Price-amount amount'><span class='woocommerce-Price-currencySymbol'>$</span>". number_format($product->get_price() * $product->get_weight(), 2, '.', '') ."<span class='woocommerce-Price-suffix'> Estimated price based on total lbs</span></span></span></span>"; } } add_action( 'woocommerce_after_single_product', 'init_sum_price_on_single_product_page', 1 ); function init_sum_price_on_single_product_page() { print "<script> summ_price_init();</script>"; }
Forum: Plugins
In reply to: [Yoast SEO] Stop notification to AUTO update the pluginyes i clicked on teh eye with a slash and yes it was hidden and yes it comes back DAILY.
there is no point to send a screenshot as i just caved in and set yoast plugin to auto update, so its not showing that message anymore daily.
but it sucks that it did shows it
but from your response it sounds like it is not suppose to happen and maybe its not happening to everyone and somehow just happening to me.Forum: Fixing WordPress
In reply to: set time to autoupdatesetting as solved, but just a quick update!
the snippet code stops wordpress from auto updating unless its in those hours, however wordpress still tries to update outside of those hours and because its not allowed, it then pushes it off again and again but it doesnt actually force the updates to run during those hours only. it simply stops auto updating if its NOT in those hours set.
so i cant use those snippet code, not what i am looking for. i install the third party plugin and that does the job!- This reply was modified 2 years, 7 months ago by ariban99.
Forum: Plugins
In reply to: [Yoast SEO] Stop notification to AUTO update the pluginHi
it comes back randomly, seems to be daily!Forum: Fixing WordPress
In reply to: set time to autoupdatewow, thank you, this is great!
Forum: Plugins
In reply to: [WooCommerce] pay what you can at checkouthi, no this is to name your price for each product. we want a similar function but at the end of the checkout process, the final total only. any other solutions?
Forum: Fixing WordPress
In reply to: critical error admin email notificationthat is possible, yes i dont have the error message as i took care of it right away to get my site back up.
is there a way around that? if php got an error, is there an smtp relay or somehting as a backup?Forum: Fixing WordPress
In reply to: critical error admin email notificationHi
it says its a PHP function, i am on a dedicated server, my PHP mail function works fine. ALL other emails work including if someone post a review or a comment on my website, i get those.
however i do NOT get emails about my website being down due to a critical error. anywhere else i can look into to find out why? any setting?Forum: Fixing WordPress
In reply to: wordpress and plugins auto update ONLY at night hoursi was hoping for a core wordpress function rather than a third party plugin is that is possible.
Forum: Plugins
In reply to: [Health Check & Troubleshooting] rest api and loopback failedi solved mine by putting this in my child them function.php, it helps close a session as marius wrote above
//fix loopback errors
add_action(‘init’, function(){
session_start(); //this loads variables to $_SESSION for reading
if( empty($your_plugin_needs_session_saving) ){
session_write_close(); //other plugins can restart a session again via session_start()
} // if session writing is needed, close session after writing is done
});Forum: Fixing WordPress
In reply to: wordpress 5.5 autoupdate plugins not enablingwhen i tried that, they said because it works on some sites and not others, they believe its a wordpress issue
Forum: Fixing WordPress
In reply to: wordpress 5.5 autoupdate plugins not enablinghi
besides the database and auth keys, this is all that is in my filedefine( ‘WP_DEBUG’, false );
define( ‘WP_DEBUG_LOG’, false );
define( ‘WP_DEBUG_DISPLAY’, false );
define(‘WP_MEMORY_LIMIT’, ‘768M’);
/* That’s all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( ‘ABSPATH’ ) ) {
define( ‘ABSPATH’, __DIR__ . ‘/’ );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . ‘wp-settings.php’;Forum: Fixing WordPress
In reply to: wordpress 5.5 autoupdate plugins not enablinghi
yes same server, i dont see anything in wp-config.php that would stop auto updates. what exactly should i look for?Forum: Plugins
In reply to: [WooCommerce] direct client to multisite based off locationyoru right, i will post on wordpress forums
Forum: Fixing WordPress
In reply to: pagespeed google cdn 500 ms loading timei understand, thank you everyone for the response and guidance, i beleive the speed is not bad but i just read so many places that its not good ot have a low score.
thank you