Disable just the checkout option in wordpress - wordpress

I have a WordPress shopping site. for the time being I want to just disable the checkout option from my site until I update all the price of the products. I tried searching over net for different solutions. but could not find any suitable solution. I am expecting to get help from here. thanks in advance. :)

remove_action( 'woocommerce_proceed_to_checkout',
'woocommerce_button_proceed_to_checkout', 20);

You can just disable all the payment options at WooCommerce->Settings page. That should refrain user from completing the order until you done with your price update.
Update:
If you want to entirely remove the button from the view, then you may need to modify the WooCommerce file. Edit the below files:
path: /woocommerce/templates/cart/cart-totals.php
//search woocommerce_proceed_to_checkout and comment the line
//this will remove the button from cart page
<?php //do_action( 'woocommerce_proceed_to_checkout' ); ?>
path: /woocommerce/includes/wc-template-functions.php
//search woocommerce_widget_shopping_cart_proceed_to_checkout and comment the line
//this will remove the checkout on the cart menu display
//echo '' . esc_html__( 'Checkout', 'woocommerce' ) . '';

Related

Dokan vendor add shortcode to each vendor

I have created e-commerce site with dokan.
I want to add each vendor their own livechat.
I have configured everything and just need to add short code to each vendor, but Dokan don't create new pages for vendors and I can't figure out how to do it.
I sniffed around in Dokan manuals, but can't find this specific field/place to enter shortcode
Can anybody point me into right directon?
You can use the dokan_store_profile_frame_after hook which runs only in the store page to add your shortcode. This hook is run just after the store profile. If you want to exclude certain stores, you can use the $store_user and $store_info to filter out the stores. You can add the following code the functions.php file of the theme.
add_action( 'wp_footer', function() {
$store_user = dokan()->vendor->get( get_query_var( 'author' ) );
$store_info = $store_user->get_shop_info();
if ( dokan_is_store_page() ) {
echo do_shortcode( '[contact-form-7 id="64" title="Contact form 1"]');
}
});
You can try using TalkJs. As per their website they support Dokan.
https://wordpress.org/plugins/talkjs/
https://talkjs.com/knowledge-base/article/does-talkjs-work-with-support/

How Do I add a back button on a product page wordpress/woocommerce without code

How do i do this, is there a good plugin? can't find any. I have tried adding code but cannot and can't find anything. All i need is a back button, a back button on my product pages... help please!
You can use the "woocommerce_before_single_product" hook and add the button to shop URL
add_action('woocommerce_before_single_product', 'add_back_button_callback');
function add_back_button_callback() {
$shop_url = get_permalink( woocommerce_get_page_id( 'shop' ) )
echo 'Back';
}

Woocommerce - change "add to cart" button url

Hi I want to change the "add to cart" button url on my single product page so when we click it , the button will redirect to another website (amazon).
Ps. im not a coder but simple code might work for me
As Mentioned the description, you want to redirect to different page after the add to cart action.
So, You can put the below code in functions.php file
function redirect_after_add_to_cart( $url ) {
return esc_url( get_permalink( get_page_by_title( 'Your Page Title' ) ) );
}
add_filter( 'woocommerce_add_to_cart_redirect', 'redirect_after_add_to_cart', 99 );
Thanks!!!
Woocommerce works with a hook system, you can redirect the URL of your add to cart button with a php shortcode but, you can also use the plugin: Woocommerce Add to cart custom redirect. The best way for you if you don't know how to use php shortcode :)
link : https://fr.wordpress.org/plugins/woocommerce-add-to-cart-custom-redirect/

Deactivate plugin on specific page

How I deactivate "WooCommerce Product Sort and Display LITE" plugin on search results page.Because it conflicts with search results.Can you please help me?
Thanks.
add_action( 'wp_print_scripts', 'my_deregister_javascript');
function my_deregister_javascript() {
if ( !is_page('Contact') ) {//pagename
wp_deregister_script( 'WooCommerce ' );//pluginname
}
}
it detect wooommerce script except contact page.

Wordpress; Vantage theme & ACF plugin?

I have repeatedly been trying to implement the Advanced Custom Fields (ACF) plugin in the Vantage theme (from AppThemes), but without any success. I've had extensive contact with the admin of ACF, on this subject, but unfortunately we did not succeed. He advised to ask here, maybe seek for a (paid) developer, to solve this problem.
Ok, so what am i trying?
I have created a custom field group and want to implement that field group within the listing form of Vantage. To do so i have read several docs, including: http://www.advancedcustomfields.com/resources/tutorials/creating-a-front-end-form/. To be complete, based on this i did the following in the Vantage theme folder:
I created 2 custom field groups, with the id's: 88 & 139.
In Wrapper.php i added the code: <?php acf_form_head(); ?>
In form-listing.php i created 2 custom hooks, 'product_custom' and 'product_custom2': <?php do_action( 'product_custom' ); ?> <?php do_action( 'product_custom2' ); ?>
In fuctions.php i created 3 functions:
add_action( 'wp_print_styles' , 'my_deregister_styles' , 100 );
function my_deregister_styles() {
wp_deregister_style( 'wp-admin' );
}
add_action( 'product_custom' , 'productfields' );
function productfields() {
$options = array(
'field_groups' => array('post' => '88' ),
'form' => false,
);
acf_form( $options );
}
add_action( 'product_custom2' , 'productfields2' );
function productfields2() {
$options2 = array(
'field_groups' => array('post' => '139' ),
'form' => false,
);
acf_form( $options2 );
}
This actually made the custom field group show up in the listing form of Vantage. However the following things keep going wrong:
Both field groups have a WYSIWYG field. However for some reason the WYSIWYG buttons and media button stop working
I cannot fill in any text in the first WYSIWYG field. Only the second one works for that matter.
No data is stored at all after saving the listing form. On advise of the ACF admin, i tried the following in the acf-master/core/api.php file:
// run database save first
if( isset($_POST['acf_save']) )
{
$txt="Hello world!";
echo $txt;
die();
However the string does not display after saving the listing form. So the if statement is not used...
4. To display the dataon the frontend, once they are saved, I guess the default wordpress codex can be used..
I tried to be as complete as possible;) Is there anybody who can help me any further? Paid assistance is also negotiable..
Thanks a lot in advance!
Robbert
I have succeed on implementing ACF with vantage themes.
I add ACF form at vantage listing form and combine the vantage form with ACF form. with one button.
The data has been saved to database and can be called to displayed in listing area. Only add image button is not working from front-end but in back-end the button is working.
Adding <?php acf_form_head(); ?> to wrapper.php
Do this tutorial front end form help
Eliminate default vantage submit button in form-listing.php
Add this code in ACF api.php in function acf_form_head()
// allow for custom save
$post_id = apply_filters('acf_form_pre_save_post','va_after_create_listing_form', $post_id);
That's it, hope it work in your site.
Is that you want when someone visits the website that they are able to send info via the page they visits eg www.yoursite.com/listing/listing-name like probably an email or contact for more info relating to that business?
If not then you can simply add in the ACF data from the back-end i.e. dreamweaver etc onto single-listing.php and use the ACF tutorial on working with fields.
Hope this helps somewhat
Cheers

Resources