问题描述
我正在尝试使用sync my fork of a repository with the original upstream branch给出的步骤here。
在第5步中运行命令之后,我在屏幕上看到一条消息,请写一条提交消息以解释为什么必须进行合并...
我写了我的消息,然后按Enter键,但没有任何反应。我尝试按esc
shift + enter
,但没有任何反应。
我还尝试了here中提到的步骤,但仍然没有任何反应。
请说明如何通过成功编写提交消息来完成此步骤?
解决方法
在临时编辑器窗口中,您可以在屏幕底部看到提示。
({function woocommerce_ajax_add_to_cart() {
global $woocommerce;
check_ajax_referer( 'add-to-cart','security' );
$product_id = apply_filters('woocommerce_add_to_cart_product_id',absint( $_POST['product_id'] ) );
$quantity = empty( $_POST['quantity'] ) ? 1 : apply_filters( 'woocommerce_stock_amount',$_POST['quantity'] );
$passed_validation = apply_filters('woocommerce_add_to_cart_validation',true,$product_id,$quantity );
$base = true;
if($base){//simple condition
header( 'Content-Type: application/json; charset=utf-8' );
// If there was an error adding to the cart,redirect to the product page to show any errors
$data = array(
'error' => true,'product_url' => apply_filters('woocommerce_cart_redirect_after_error',get_permalink( $product_id ),$product_id)
);
$woocommerce->set_messages();
echo json_encode( $data );
}else{
if ( $passed_validation && $woocommerce->cart->add_to_cart( $product_id,$quantity ) ) {
do_action( 'woocommerce_ajax_added_to_cart',$product_id );
if ( get_option( 'woocommerce_cart_redirect_after_add' ) == 'yes' ) {
woocommerce_add_to_cart_message( $product_id );
$woocommerce->set_messages();
}
// Return fragments
woocommerce_get_refreshed_fragments();
} else {
header( 'Content-Type: application/json; charset=utf-8' );
// If there was an error adding to the cart,$product_id)
);
$woocommerce->set_messages();
echo json_encode( $data );
}
}
die();
}
add_action('wp_ajax_woocommerce_add_to_cart','woocommerce_ajax_add_to_cart');
add_action('wp_ajax_nopriv_woocommerce_add_to_cart','woocommerce_ajax_add_to_cart');
应理解为^X Exit
)
然后它将返回要在提交中使用的消息。